• 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

  • 相关阅读:
    Linux防火墙管理(iptables)以及开放端口配置
    CSS 样式引入方式、常用选择器以及优先级权重的计算
    初识外边距合并-margin collapsing
    纯CSS实现自适应正方形
    常用正则
    vue 学习记录
    VScode 之快速创建vue模板
    vscode之常用插件
    工具函数
    Axios之配置参数
  • 原文地址:https://www.cnblogs.com/james-roger/p/5885343.html
Copyright © 2020-2023  润新知