jpa的context.xml文件

来源:互联网 发布:linux主机监控 编辑:程序博客网 时间:2024/05/15 15:19

context.xml文件为:

<?xml version='1.0' encoding='utf-8'?>

/*这个context元素监视的引用元素定义文件,我们还有指定一个被监视的资源,在这个资源里面,会定义context中定义的

那个资源被引用了,对于web应用而已,这个被监视的资源当然是web.xml文件,同时,也意味着我们应该在web.xml中

定义JNDI资源引用元素。所以在context元素中有了一个子元素<WatchedResource>WEB-INF/web.xml</WatchedResource>

数据源是作为context中定义的一个资源存在的。当然,也可以在context中定义其他的JNDI资源。如<Resource/>.


*/
<Context debug="5" reloadable="false" crossContext="true">
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<Logger className="org.apache.catalina.logger.FileLogger" directory="logs" prefix="freegym_log." suffix=".txt" timestamp="true"/>
<Resource name="jdbc/project"
type="javax.sql.DataSource"
auth="Container"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://1localhost3306/databaseName?characterEncoding=utf-8"
username="root"
password="123"
maxActive="50"
maxIdle="100"
minIdle="0"
removeAbandoned="true"
removeAbandonedTimeout="60"
logAbandoned="true"
  maxWait="-1"/>
</Context>