首页 > 代码库 > applicationContext.xml和web.xml的一些配置
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="http://www.mamicode.com/${jdbc.url}" /> <property name="username" value="http://www.mamicode.com/${jdbc.username}" /> <property name="password" value="http://www.mamicode.com/${jdbc.password}" /> <!-- 配置初始化大小、最小、最大 --> <property name="initialSize" value="http://www.mamicode.com/5" /> <property name="minIdle" value="http://www.mamicode.com/5" /> <property name="maxActive" value="http://www.mamicode.com/20" /> <!-- 配置获取连接等待超时的时间 --> <property name="maxWait" value="http://www.mamicode.com/60000" /> <!--打开PSCache,并且指定每个连接上PSCache的大小 ,Oracle,把poolPreparedStatements配置为true,mysql可以配置为false。分库分表较多的数据库,建议配置为false--> <property name="poolPreparedStatements" value="http://www.mamicode.com/false" /> <property name="maxPoolPreparedStatementPerConnectionSize" value="http://www.mamicode.com/20" /> <!-- 开启Druid的监控统计功能 --> <property name="filters" value="http://www.mamicode.com/stat,config" /> <!-- 开启数据库密码解密--> <property name="connectionProperties" value="http://www.mamicode.com/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="http://www.mamicode.com/${jdbc.driver}" /> <property name="url" value="http://www.mamicode.com/${jdbc.url}" /> <property name="username" value="http://www.mamicode.com/${jdbc.username}" /> <property name="password" value="http://www.mamicode.com/${jdbc.password}" /> Connection Pooling Info <property name="maxActive" value="http://www.mamicode.com/${jdbc.pool.maxActive}" /> <property name="maxIdle" value="http://www.mamicode.com/${jdbc.pool.maxIdle}" /> <property name="minIdle" value="http://www.mamicode.com/0" /> <property name="defaultAutoCommit" value="http://www.mamicode.com/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;@Componentpublic 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的一些配置
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。