您的位置:首页 > 运维架构 > Tomcat

tomcat JNDI 设置

2016-07-11 15:34 453 查看
一、在Spring配置文件中的配置

<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName">
<value>java:comp/env/jndi/mybatis</value>
</property>
</bean>

二、在项目中web.xml的配置(这些标签就是用来建立当前应用环境到服务器资源的映射的)

<resource-ref>

<description>JNDI DataSource</description>
<res-ref-name>jndi/mybatis</res-ref-name>
<res-ref-type>javax.sql.DataSource</res-ref-type>
<res-auth>Container</res-auth>
</resource-ref>
三、在conf 中context.xml

<Resource name="jndi/mybatis"
auth="Container"
type="javax.sql.DataSource"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/3dback"
username="root"
password="123456"
maxActive="20"
maxIdle="10"
maxWait="10000"/>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: