相关配置文件

1.web.xml配置

 1 <?xml version="1.0" encoding="UTF-8"?>
 2 <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 3          xmlns="http://java.sun.com/xml/ns/javaee"
 4          xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
 5          id="WebApp_ID" version="2.5">
 6 
 7     <display-name>Archetype Created Web Application</display-name>
 8 
 9     <!--过滤器的配置,转码作用,也就是-->
10     <filter>
11         <filter-name>characterEncodingFilter</filter-name>
12         <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
13         <init-param>
14             <!--字符集,即将过滤到的request的字符集设置为encoding指定的值,如UTF-8等-->
15             <param-name>encoding</param-name>
16             <param-value>UTF-8</param-value>
17         </init-param>
18         <init-param>
19             <!--这个参数的值只不过是指定response的字符集是否也设置成encoding所指定的字符集,所以你可以选择设置为true或false,当值为true时,表示与encoding相同-->
20             <param-name>forceEncoding</param-name>
21             <param-value>true</param-value>
22         </init-param>
23     </filter>
24     <filter-mapping>
25         <filter-name>characterEncodingFilter</filter-name>
26         <!--拦截的路径是/*,也就是所有路径都拦截-->
27         <url-pattern>/*</url-pattern>
28     </filter-mapping>
29 
30     <!--二期新增重置session时间的filter-->
31     <filter>
32         <filter-name>sessionExpireFilter</filter-name>
33         <filter-class>com.mall.controller.common.SessionExpireFilter</filter-class>
34     </filter>
35     <filter-mapping>
36         <filter-name>sessionExpireFilter</filter-name>
37         <url-pattern>*.do</url-pattern>
38     </filter-mapping>
39 <!--    <filter>
40         <filter-name>springSessionRepositoryFilter</filter-name>
41         <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
42     </filter>
43     <filter-mapping>
44         <filter-name>springSessionRepositoryFilter</filter-name>
45         <url-pattern>*.do</url-pattern>
46     </filter-mapping>-->
47 
48     <listener>
49         <!--将Spring容器与Web容器结合的更加密切,可选配置-->
50         <!--只负责监听web容器启动和关闭的监听器-->
51         <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
52     </listener>
53 
54     <listener>
55         <!--将Web容器与spring容器整合的监听器,必选配置,通过下面配置的applicationContext.xml将web容器和spring进行整合-->
56         <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
57     </listener>
58     <context-param>
59         <param-name>contextConfigLocation</param-name>
60         <param-value>
61             classpath:applicationContext.xml
62         </param-value>
63     </context-param>
64 
65     <!--配置springmvc,拦截下面配置的*.do的所有请求,-->
66     <servlet>
67         <servlet-name>dispatcher</servlet-name>
68         <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
69         <!-->=0时,容器启动时就会初始化servlet,也就是调用DispatcherServlet中的init()方法-->
70         <!--<0或者不指定时,这个servlet被使用时才会被加载-->
71         <load-on-startup>1</load-on-startup>
72     </servlet>
73 <!--    <servlet-mapping>
74         <servlet-name>dispatcher</servlet-name>
75         <url-pattern>*.do</url-pattern>
76     </servlet-mapping>-->
77 
78     <!--restful-->
79     <servlet-mapping>
80         <servlet-name>dispatcher</servlet-name>
81         <url-pattern>/</url-pattern>
82     </servlet-mapping>
83 </web-app>
View Code

ps:在tomcat启动时就把spring配置文件加载出来,利用spring的filter把字符集配置好。

2.dispatcher-servlet.xml配置

 1 <?xml version="1.0" encoding="UTF-8"?>
 2 <beans xmlns="http://www.springframework.org/schema/beans"
 3        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
 4        xmlns:context="http://www.springframework.org/schema/context"
 5        xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:aop="http://www.springframework.org/schema/aop"
 6        xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
 7     http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
 8     http://www.springframework.org/schema/mvc
 9     http://www.springframework.org/schema/mvc/spring-mvc.xsd">
10 
11     <context:component-scan base-package="com.mall" annotation-config="true"/>
12 
13     <mvc:annotation-driven>
14         <mvc:message-converters>
15             <!--配置编码-->
16             <bean class="org.springframework.http.converter.StringHttpMessageConverter">
17                 <property name="supportedMediaTypes">
18                     <list>
19                         <value>text/plain;charset=UTF-8</value>
20                         <value>text/html;charset=UTF-8</value>
21                     </list>
22                 </property>
23             </bean>
24             <!--springmvc反序列化的配置-->
25             <bean class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter">
26                 <property name="supportedMediaTypes">
27                     <list>
28                         <value>application/json;charset=UTF-8</value>
29                     </list>
30                 </property>
31             </bean>
32         </mvc:message-converters>
33     </mvc:annotation-driven>
34 
35 
36 
37     <!-- 文件上传 -->
38     <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
39         <property name="maxUploadSize" value="10485760"/> <!-- 10m -->
40         <property name="maxInMemorySize" value="4096" />
41         <property name="defaultEncoding" value="UTF-8"></property>
42     </bean>
43 
44     <mvc:interceptors>
45         <!--定义在这里的,所有的都会拦截-->
46         <mvc:interceptor>
47             <!--manage/a.do     /manage/*-->
48             <!--manage/product/save.do      /manage/**-->
49             <!--manage/order/detail.do      /manage/**-->
50             <mvc:mapping path="/manage/**"/>
51         <!--    <mvc:exclude-mapping path="/manage/user/login.do"/> -->
52             <bean class="com.mall.controller.common.interceptor.AuthorityInterceptor"></bean>
53         </mvc:interceptor>
54     </mvc:interceptors>
55 
56 </beans>
View Code

ps:配置SpringMVC,拦截某些请求的后缀的配置,例如在里面配置SpringMVC的Json插件,就可以使controler通过@ResponseBody这个注解把返回值自动进行序列化。

3.applicationContext.xml配置

 1 <?xml version="1.0" encoding="UTF-8"?>
 2 <beans xmlns="http://www.springframework.org/schema/beans"
 3        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
 4        xmlns:tx="http://www.springframework.org/schema/tx" xmlns:jdbc="http://www.springframework.org/schema/jdbc"
 5        xmlns:context="http://www.springframework.org/schema/context"
 6        xmlns:task="http://www.springframework.org/schema/task"
 7        xsi:schemaLocation="http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
 8      http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
 9      http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
10      http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd">
11 
12     <context:component-scan base-package="com.mall" annotation-config="true"/>
13 
14     <!--<context:annotation-config/>-->
15     <aop:aspectj-autoproxy/>
16 
17     <!--二期新增spring schedule时新增,会把配置的属性都自动获取到下面的xml文件中,代替以前利用db.的方式从.properties取-->
18     <context:property-placeholder location="classpath:datasource.properties"/>
19     <task:annotation-driven/>
20 
21     <import resource="applicationContext-datasource.xml"/>
22 
23     <import resource="applicationContext-spring-session.xml"/>
24 
25 </beans>
View Code

4.applicationContext-datasource.xml配置

 1 <?xml version="1.0" encoding="UTF-8"?>
 2 <beans xmlns="http://www.springframework.org/schema/beans"
 3        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
 4        xmlns:tx="http://www.springframework.org/schema/tx" xmlns:jdbc="http://www.springframework.org/schema/jdbc"
 5        xmlns:context="http://www.springframework.org/schema/context"
 6        xsi:schemaLocation="
 7      http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
 8      http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
 9      http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
10      http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd">
11 
12     <context:component-scan base-package="com.mall" annotation-config="true">
13     </context:component-scan>
14 
15     <!--把常量分离到datasource.properties中-->
16     <bean id="propertyConfigurer"
17           class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
18         <property name="order" value="2"/>
19         <property name="ignoreUnresolvablePlaceholders" value="true"/>
20         <property name="locations">
21             <list>
22                 <value>classpath:datasource.properties</value>
23             </list>
24         </property>
25         <property name="fileEncoding" value="utf-8"/>
26     </bean>
27 
28     <!--数据库连接池配置-->
29     <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
30         <property name="driverClassName" value="${db.driverClassName}"/>
31         <property name="url" value="${db.url}"/>
32         <property name="username" value="${db.username}"/>
33         <property name="password" value="${db.password}"/>
34         <!-- 连接池启动时的初始值 -->
35         <property name="initialSize" value="${db.initialSize}"/>
36         <!-- 连接池的最大值 -->
37         <property name="maxActive" value="${db.maxActive}"/>
38         <!-- 最大空闲值.当经过一个高峰时间后,连接池可以慢慢将已经用不到的连接慢慢释放一部分,一直减少到maxIdle为止 -->
39         <property name="maxIdle" value="${db.maxIdle}"/>
40         <!-- 最小空闲值.当空闲的连接数少于阀值时,连接池就会预申请去一些连接,以免洪峰来时来不及申请 -->
41         <property name="minIdle" value="${db.minIdle}"/>
42         <!-- 最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制 -->
43         <property name="maxWait" value="${db.maxWait}"/>
44         <!--#给出一条简单的sql语句进行验证 -->
45          <!--<property name="validationQuery" value="select getdate()" />-->
46         <property name="defaultAutoCommit" value="${db.defaultAutoCommit}"/>
47         <!-- 回收被遗弃的(一般是忘了释放的)数据库连接到连接池中 -->
48          <!--<property name="removeAbandoned" value="true" />-->
49         <!-- 数据库连接过多长时间不用将被视为被遗弃而收回连接池中 -->
50          <!--<property name="removeAbandonedTimeout" value="120" />-->
51         <!-- #连接的超时时间,默认为半小时。 -->
52         <property name="minEvictableIdleTimeMillis" value="${db.minEvictableIdleTimeMillis}"/>
53 
54         <!--# 失效检查线程运行时间间隔,要小于MySQL默认-->
55         <property name="timeBetweenEvictionRunsMillis" value="40000"/>
56         <!--# 检查连接是否有效-->
57         <property name="testWhileIdle" value="true"/>
58         <!--# 检查连接有效性的SQL语句-->
59         <property name="validationQuery" value="SELECT 1 FROM dual"/>
60     </bean>
61 
62     <!--整合mybatis-->
63     <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
64         <!--指定数据源,这里的ref就是上面定义的一个bean的id,这里的name的取名是因为在SqlSessionFactoryBean中有dataSource的属性-->
65         <property name="dataSource" ref="dataSource"/>
66         <!--自动扫描配置文件-->
67         <property name="mapperLocations" value="classpath*:mappers/*Mapper.xml"></property>
68 
69         <!-- 分页插件 -->
70         <property name="plugins">
71             <array>
72                 <bean class="com.github.pagehelper.PageHelper">
73                     <property name="properties">
74                         <value>
75                             dialect=mysql
76                         </value>
77                     </property>
78                 </bean>
79             </array>
80         </property>
81 
82     </bean>
83 
84     <bean name="mapperScannerConfigurer" class="org.mybatis.spring.mapper.MapperScannerConfigurer">
85         <property name="basePackage" value="com.mall.dao"/>
86     </bean>
87 
88     <!-- 使用@Transactional进行声明式事务管理需要声明下面这行 -->
89     <tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true" />
90     <!-- 事务管理 -->
91     <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
92         <property name="dataSource" ref="dataSource"/>
93         <!--是否回滚-->
94         <property name="rollbackOnCommitFailure" value="true"/>
95     </bean>
96 
97 
98 </beans>
View Code

ps:spring整合mybatis。

5.generatorConfig.xml配置

 1 <?xml version="1.0" encoding="UTF-8"?>
 2 <!DOCTYPE generatorConfiguration
 3         PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
 4         "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
 5 
 6 <generatorConfiguration>
 7     <!--导入属性配置-->
 8     <properties resource="datasource.properties"></properties>
 9 
10     <!--指定特定数据库的jdbc驱动jar包的位置-->
11     <classPathEntry location="${db.driverLocation}"/>
12 
13     <context id="default" targetRuntime="MyBatis3">
14 
15         <!-- optional,旨在创建class时,对注释进行控制 -->
16         <commentGenerator>
17             <property name="suppressDate" value="true"/>
18             <property name="suppressAllComments" value="true"/>
19         </commentGenerator>
20 
21         <!--jdbc的数据库连接 -->
22         <jdbcConnection
23                 driverClass="${db.driverClassName}"
24                 connectionURL="${db.url}"
25                 userId="${db.username}"
26                 password="${db.password}">
27         </jdbcConnection>
28 
29 
30         <!-- 非必需,类型处理器,在数据库类型和java类型之间的转换控制-->
31         <javaTypeResolver>
32             <property name="forceBigDecimals" value="false"/>
33         </javaTypeResolver>
34 
35 
36         <!-- Model模型生成器,用来生成含有主键key的类,记录类 以及查询Example类
37             targetPackage     指定生成的model生成所在的包名
38             targetProject     指定在该项目下所在的路径
39         -->
40         <!--<javaModelGenerator targetPackage="com.mall.pojo" targetProject=".\src\main\java">-->
41         <javaModelGenerator targetPackage="com.mall.pojo" targetProject="./src/main/java">
42             <!-- 是否允许子包,即targetPackage.schemaName.tableName -->
43             <property name="enableSubPackages" value="false"/>
44             <!-- 是否对model添加 构造函数 -->
45             <property name="constructorBased" value="true"/>
46             <!-- 是否对类CHAR类型的列的数据进行trim操作 -->
47             <property name="trimStrings" value="true"/>
48             <!-- 建立的Model对象是否 不可改变  即生成的Model对象不会有 setter方法,只有构造方法 -->
49             <property name="immutable" value="false"/>
50         </javaModelGenerator>
51 
52         <!--mapper映射文件生成所在的目录 为每一个数据库的表生成对应的SqlMap文件 -->
53         <!--<sqlMapGenerator targetPackage="mappers" targetProject=".\src\main\resources">-->
54         <sqlMapGenerator targetPackage="mappers" targetProject="./src/main/resources">
55             <property name="enableSubPackages" value="false"/>
56         </sqlMapGenerator>
57 
58         <!-- 客户端代码,生成易于使用的针对Model对象和XML配置文件 的代码
59                 type="ANNOTATEDMAPPER",生成Java Model 和基于注解的Mapper对象
60                 type="MIXEDMAPPER",生成基于注解的Java Model 和相应的Mapper对象
61                 type="XMLMAPPER",生成SQLMap XML文件和独立的Mapper接口
62         -->
63 
64         <!-- targetPackage:mapper接口dao生成的位置 -->
65         <!--<javaClientGenerator type="XMLMAPPER" targetPackage="com.mmall.dao" targetProject=".\src\main\java">-->
66         <javaClientGenerator type="XMLMAPPER" targetPackage="com.mall.dao" targetProject="./src/main/java">
67             <!-- enableSubPackages:是否让schema作为包的后缀 -->
68             <property name="enableSubPackages" value="false" />
69         </javaClientGenerator>
70 
71 
72         <table tableName="shipping" domainObjectName="Shipping" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
73         <table tableName="cart" domainObjectName="Cart" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
74         <table tableName="cart_item" domainObjectName="CartItem" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
75         <table tableName="category" domainObjectName="Category" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
76         <table tableName="mall_order" domainObjectName="Order" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
77         <table tableName="order_item" domainObjectName="OrderItem" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
78         <table tableName="pay_info" domainObjectName="PayInfo" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
79         <table tableName="product" domainObjectName="Product" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false">
80             <columnOverride column="detail" jdbcType="VARCHAR" />
81             <columnOverride column="sub_images" jdbcType="VARCHAR" />
82         </table>
83         <table tableName="user" domainObjectName="User" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
84 
85 
86         <!-- geelynote mybatis插件的搭建 -->
87     </context>
88 </generatorConfiguration>
View Code

ps:POJO对象和数据表的映射关系。

6.applicationContext-spring-session.xml配置

 1 <?xml version="1.0" encoding="UTF-8"?>
 2 <beans xmlns="http://www.springframework.org/schema/beans"
 3        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
 4        xmlns:tx="http://www.springframework.org/schema/tx" xmlns:jdbc="http://www.springframework.org/schema/jdbc"
 5        xmlns:context="http://www.springframework.org/schema/context"
 6        xsi:schemaLocation="
 7      http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
 8      http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
 9      http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
10      http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd">
11 
12 
13     <bean id="redisHttpSessionConfiguration" class="org.springframework.session.data.redis.config.annotation.web.http.RedisHttpSessionConfiguration">
14         <property name="maxInactiveIntervalInSeconds" value="300"/>
15 
16     </bean>
17     <!--cookie注入-->
18     <bean id="defaultCookieSerializer" class="org.springframework.session.web.http.DefaultCookieSerializer">
19     <!--    <property name="cookieName" value="SESSION_NAME"/> -->
20         <property name="domainName" value=".mall.com"/>
21         <property name="useHttpOnlyCookie" value="true"/>
22         <property name="cookiePath" value="/"/>
23         <property name="cookieMaxAge" value="31536000"/>
24     </bean>
25 
26     <bean id = "jedisPoolConfig" class="redis.clients.jedis.JedisPoolConfig">
27         <property name="maxTotal" value="20"/>
28     </bean>
29 
30     <bean id="jedisConnectionFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory">
31         <property name="hostName" value="127.0.0.1"/>
32         <property name="port" value="6379"/>
33         <property name="poolConfig" ref = "jedisPoolConfig"/>
34     </bean>
35 
36 
37 </beans>
View Code

ps:spring整合springMVC。

7.logback.xml配置

 1 <?xml version="1.0" encoding="UTF-8"?>
 2 <configuration scan="true" scanPeriod="60 seconds" debug="false">
 3     <!--console表示会打印到catalina.out这个文件里-->
 4     <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
 5         <encoding>UTF-8</encoding>
 6         <encoder>
 7             <!--日志的格式-->
 8             <pattern>[%d{HH:mm:ss.SSS}][%p][%c{40}][%t] %m%n</pattern>
 9         </encoder>
10         <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
11             <!--大于DEBUG的级别都会显示-->
12             <level>DEBUG</level>
13         </filter>
14     </appender>
15 
16     <!--配置项目相关的日志,这里会将日志打印到mall.log中-->
17     <appender name="mall" class="ch.qos.logback.core.rolling.RollingFileAppender">
18         <File>E:\software_setup\apache-tomcat-8.0.33-windows-x64\apache-tomcat-8.0.33\logs\mall.log</File>
19         <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
20             <fileNamePattern>E:\software_setup\apache-tomcat-8.0.33-windows-x64\apache-tomcat-8.0.33\logs\mall.log.%d{yyyy-MM-dd}.gz</fileNamePattern>
21             <append>true</append>
22             <!--最大的存储时期,这里配置成10天-->
23             <maxHistory>10</maxHistory>
24         </rollingPolicy>
25         <encoder>
26             <pattern>[%d{HH:mm:ss.SSS}][%p][%c{40}][%t] %m%n</pattern>
27         </encoder>
28     </appender>
29 
30     <!--日志会打印到error.log中-->
31     <appender name="error" class="ch.qos.logback.core.rolling.RollingFileAppender">
32         <File>E:\software_setup\apache-tomcat-8.0.33-windows-x64\apache-tomcat-8.0.33\logs\error.log</File>
33         <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
34             <fileNamePattern>E:\software_setup\apache-tomcat-8.0.33-windows-x64\apache-tomcat-8.0.33\logs\error.log.%d{yyyy-MM-dd}.gz</fileNamePattern>
35             <append>true</append>
36             <maxHistory>10</maxHistory>
37         </rollingPolicy>
38         <encoder>
39             <pattern>[%d{HH:mm:ss.SSS}][%p][%c{40}][%t] %m%n</pattern>
40         </encoder>
41         <filter class="ch.qos.logback.classic.filter.LevelFilter">
42             <!--级别配成error级别,如果是error级别就打印,否则拒绝打印-->
43             <level>ERROR</level>
44             <onMatch>ACCEPT</onMatch>
45             <onMismatch>DENY</onMismatch>
46         </filter>
47     </appender>
48 
49     <!--info级别的信息都会打印到mall和console中-->
50     <logger name="com.mall" additivity="false" level="INFO" >
51         <appender-ref ref="mall" />
52         <appender-ref ref="console"/>
53     </logger>
54 
55 
56 
57     <!-- geelynote mybatis log 日志 -->
58     <!--dao层出现的sql都可以查看-->
59     <logger name="com.mall.dao" level="DEBUG"/>
60 
61     <root level="DEBUG">
62         <appender-ref ref="console"/>
63         <appender-ref ref="error"/>
64     </root>
65 
66 </configuration>
View Code

ps:日志信息配置。

posted on 2017-11-07 17:06  二十年后20  阅读(172)  评论(0编辑  收藏  举报

导航