applicationContext.xml和web.xml的一些配置
Posted james-roger
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了applicationContext.xml和web.xml的一些配置相关的知识,希望对你有一定的参考价值。
applicationContext.xml
<!-- test环境 --> <beans profile="test"> <context:property-placeholder ignore-unresolvable="true" location="classpath*:config/jdbc.test.properties" /> <!--阿里巴巴druid,高效、功能强大、可扩展性好,便于sql监控分析--> <bean id="mysqlDataSource" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close"> <property name="url" value="${jdbc.url}" /> <property name="username" value="${jdbc.username}" /> <property name="password" value="${jdbc.password}" /> <!-- 配置初始化大小、最小、最大 --> <property name="initialSize" value="5" /> <property name="minIdle" value="5" /> <property name="maxActive" value="20" /> <!-- 配置获取连接等待超时的时间 --> <property name="maxWait" value="60000" /> <!--打开PSCache,并且指定每个连接上PSCache的大小 ,Oracle,把poolPreparedStatements配置为true,mysql可以配置为false。分库分表较多的数据库,建议配置为false--> <property name="poolPreparedStatements" value="false" /> <property name="maxPoolPreparedStatementPerConnectionSize" value="20" /> <!-- 开启Druid的监控统计功能 --> <property name="filters" value="stat,config" /> <!-- 开启数据库密码解密--> <property name="connectionProperties" value="config.decrypt=${jdbc.decrypt};config.decrypt.key=${jdbc.publickey}" /> </bean> <!-- 数据源1配置, 使用Tomcat JDBC连接池 --> <!-- <bean id="mysqlDataSource" class="org.apache.tomcat.jdbc.pool.DataSource" destroy-method="close"> Connection Info <property name="driverClassName" value="${jdbc.driver}" /> <property name="url" value="${jdbc.url}" /> <property name="username" value="${jdbc.username}" /> <property name="password" value="${jdbc.password}" /> Connection Pooling Info <property name="maxActive" value="${jdbc.pool.maxActive}" /> <property name="maxIdle" value="${jdbc.pool.maxIdle}" /> <property name="minIdle" value="0" /> <property name="defaultAutoCommit" value="true" /> </bean> --> </beans>
web.xml
<context-param> <param-name>spring.profiles.active</param-name> <param-value>test</param-value> </context-param>
ServletContextListener:
https://my.oschina.net/bayuanqian/blog/160073
HttpSessionListener:
http://blog.csdn.net/vastskyjoe/article/details/4152661
package com.test.listenner; import javax.servlet.http.HttpSessionEvent; import javax.servlet.http.HttpSessionListener; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; @Component public class SessionListener implements HttpSessionListener { private static final Logger log = LoggerFactory.getLogger(SessionListener.class); @Override public void sessionCreated(HttpSessionEvent event) { log.info("session["+event.getSession().getId()+"]生效..."); } @Override public void sessionDestroyed(HttpSessionEvent event) { log.info("session["+event.getSession().getId()+"]失效..."); } }
com.alibaba.druid.support.http.WebStatFilter
http://blog.csdn.net/lgh1117/article/details/48789927
阿里巴巴Sql监控
com.alibaba.druid.support.http.StatViewServlet
http://blog.csdn.net/supingemail/article/details/50809982
com.alibaba.druid.support.spring.stat.DruidStatInterceptor
http://blog.csdn.net/yinxiangbing/article/details/47905403
以上是关于applicationContext.xml和web.xml的一些配置的主要内容,如果未能解决你的问题,请参考以下文章
applicationContext.xml和web.xml的一些配置
Spring Framework中applicationContext.xml和spring-servlet.xml的区别
Spring Framework中applicationContext.xml和spring-servlet.xml的区别
applicationContext.xml和dispatcher-servlet.xml的区别