spring

  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"
  4. xmlns:context="http://www.springframework.org/schema/context"
  5. xmlns:aop="http://www.springframework.org/schema/aop"
  6. xmlns:tx="http://www.springframework.org/schema/tx"
  7. xmlns:mvc="http://www.springframework.org/schema/mvc"
  8. xsi:schemaLocation="
  9. http://www.springframework.org/schema/beans
  10. http://www.springframework.org/schema/beans/spring-beans.xsd
  11. http://www.springframework.org/schema/context
  12. http://www.springframework.org/schema/context/spring-context.xsd
  13. http://www.springframework.org/schema/tx
  14. http://www.springframework.org/schema/tx/spring-tx.xsd
  15. http://www.springframework.org/schema/aop
  16. http://www.springframework.org/schema/aop/spring-aop.xsd
  17. http://www.springframework.org/schema/mvc
  18. http://www.springframework.org/schema/mvc/spring-mvc.xsd">
  19. <context:annotation-config/>
  20. <context:component-scan base-package=""/>
  21. <mvc:annotation-driven/>
  22. </beans>

spring-ioc

  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"
  4. xsi:schemaLocation="http://www.springframework.org/schema/beans
  5. http://www.springframework.org/schema/beans/spring-beans.xsd">
  6. </beans>

spring-ioc-annotation(spring-context)

  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"
  4. xmlns:context="http://www.springframework.org/schema/context"
  5. xsi:schemaLocation="http://www.springframework.org/schema/beans
  6. http://www.springframework.org/schema/beans/spring-beans.xsd
  7. http://www.springframework.org/schema/context
  8. http://www.springframework.org/schema/context/spring-context.xsd">
  9. <context:annotation-config/>
  10. <context:component-scan base-package=""/>
  11. </beans>

spring-mvc

  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"
  4. xmlns:mvc="http://www.springframework.org/schema/mvc"
  5. xsi:schemaLocation="http://www.springframework.org/schema/beans
  6. http://www.springframework.org/schema/beans/spring-beans.xsd
  7. http://www.springframework.org/schema/mvc
  8. http://www.springframework.org/schema/mvc/spring-mvc.xsd">
  9. <mvc:annotation-driven/>
  10. </beans>

spring-mybatis

  1. <beans xmlns="http://www.springframework.org/schema/beans"
  2. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  3. xmlns:context="http://www.springframework.org/schema/context"
  4. xmlns:tx="http://www.springframework.org/schema/tx"
  5. xsi:schemaLocation="http://www.springframework.org/schema/beans
  6. http://www.springframework.org/schema/beans/spring-beans.xsd
  7. http://www.springframework.org/schema/context
  8. http://www.springframework.org/schema/context/spring-context.xsd
  9. http://www.springframework.org/schema/tx
  10. http://www.springframework.org/schema/tx/spring-tx.xsd">
  11. </beans>

struts

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE struts PUBLIC
  3. "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
  4. "http://struts.apache.org/dtds/struts-2.3.dtd">
  5. <struts>
  6. </struts>

web

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
  5. version="4.0">
  6. </web-app>

mapper

  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="">
  6. </mapper>

mybatis-config

  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
  3. "http://mybatis.org/dtd/mybatis-3-config.dtd">
  4. <configuration>
  5. </configuration>

log4j

  1. log4j.rootLogger=DEBUG,stdout
  2. # MyBatis logging configuration...
  3. log4j.logger.org.mybatis.example.BlogMapper=TRACE
  4. # Console output...
  5. log4j.appender.stdout=org.apache.log4j.ConsoleAppender
  6. log4j.appender.stdout.layout=org.apache.log4j.PatternLayout\
  7. log4j.appender.stdout.layout.ConversionPattern=[%t] %5p - %msg \:%m%n

generatorConfig

  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. <generatorConfiguration>
  6. <!-- 引入数据库连接配置 -->
  7. <!--<properties resource="jdbc.properties"/>-->
  8. <context id="Mysql" targetRuntime="MyBatis3Simple" defaultModelType="flat">
  9. <property name="beginningDelimiter" value="`"/>
  10. <property name="endingDelimiter" value="`"/>
  11. <!-- 配置 GeneralDAO -->
  12. <plugin type="tk.mybatis.mapper.generator.MapperPlugin">
  13. <property name="mappers" value=""/>
  14. </plugin>
  15. <!-- 配置数据库连接 -->
  16. <jdbcConnection driverClass="com.mysql.cj.jdbc.Driver"
  17. connectionURL="jdbc:mysql://localhost:3306/"
  18. userId="root" password="mysql">
  19. </jdbcConnection>
  20. <!-- 配置实体类存放路径 -->
  21. <javaModelGenerator targetPackage="" targetProject="src/main/java"/>
  22. <!-- 配置 XML 存放路径 -->
  23. <sqlMapGenerator targetPackage="/" targetProject="src/main/resources/mappers"/>
  24. <!-- 配置 DAO 存放路径 -->
  25. <javaClientGenerator targetPackage="" targetProject="src/main/java" type="XMLMAPPER"/>
  26. <!-- 配置需要指定生成的数据库和表,% 代表所有表 -->
  27. <table tableName="%">
  28. <!-- mysql 配置 -->
  29. <!-- <generatedKey column="id" sqlStatement="Mysql" identity="true"/>-->
  30. </table>
  31. <!-- <table tableName="tb_roles">-->
  32. <!-- &lt;!&ndash; mysql 配置 &ndash;&gt;-->
  33. <!-- <generatedKey column="roleid" sqlStatement="Mysql" identity="true"/>-->
  34. <!-- </table>-->
  35. <!-- <table tableName="tb_permissions">-->
  36. <!-- &lt;!&ndash; mysql 配置 &ndash;&gt;-->
  37. <!-- <generatedKey column="perid" sqlStatement="Mysql" identity="true"/>-->
  38. <!-- </table>-->
  39. </context>
  40. </generatorConfiguration>

logback-spring

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <configuration>
  3. <appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
  4. <encoder>
  5. <springProfile name="dev">
  6. <pattern>%d{yyyy-MM-dd-HH:mm:ss E} %level [%thread]-%class[%line]: %msg%n</pattern>
  7. </springProfile>
  8. <springProfile name="!dev">
  9. <pattern>%d{yyyy-MM-dd-HH:mm:ss E} %level [%thread]-%class[%line]: %msg%n</pattern>
  10. </springProfile>
  11. <!--日志的编码格式-->
  12. <charset>UTF-8</charset>
  13. </encoder>
  14. </appender>
  15. <!--这个就表示的是把日志输出到文件(FileAppender)-->
  16. <appender name="file" class="ch.qos.logback.core.FileAppender">
  17. <file>D:/log/output.log</file>
  18. <!--设置日志是否追加-->
  19. <append>true</append>
  20. <encoder>
  21. <pattern>%d{yyyy-MM-dd-HH:mm:ss:SSS} %level [%thread]-%class:%line>>%msg%n</pattern>
  22. <charset>UTF-8</charset>
  23. </encoder>
  24. <!--设置日志写入是否线程安全-->
  25. <prudent>false</prudent>
  26. </appender>
  27. <appender name="timeFile" class="ch.qos.logback.core.rolling.RollingFileAppender">
  28. <!--TimeBasedRollingPolicy 基于时间的滚动策略-->
  29. <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
  30. <fileNamePattern>d:/log/log-%d{yyyy-MM-dd-HH}.log</fileNamePattern>
  31. </rollingPolicy>
  32. <encoder>
  33. <pattern>%d{yyyy-MM-dd-HH:mm:ss.SSS} %level [%thread]-%class:%line>>%msg%n</pattern>
  34. <charset>UTF-8</charset>
  35. </encoder>
  36. </appender>
  37. <!--基于文件大小保存策略-->
  38. <appender name="fixedFile" class="ch.qos.logback.core.rolling.RollingFileAppender">
  39. <file>d:/log/fixedFile.log</file>
  40. <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
  41. <fileNamePattern>log/fixedFile%i.log</fileNamePattern>
  42. <minIndex>1</minIndex>
  43. <maxIndex>10</maxIndex>
  44. </rollingPolicy>
  45. <!--SizeBasedTriggeringPolicy-->
  46. <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
  47. <maxFileSize>5MB</maxFileSize>
  48. </triggeringPolicy>
  49. <encoder>
  50. <pattern>%d{yyyy-MM-dd-HH:mm:ss.SSS} %level [%thread]-%class:%line>>%msg%n</pattern>
  51. <charset>UTF-8</charset>
  52. </encoder>
  53. </appender>
  54. <root level="info">
  55. <appender-ref ref="stdout"/>
  56. <appender-ref ref="timeFile"/>
  57. </root>
  58. </configuration>