标签:最大 count ext 特定 man aging filters 超时 大小
web.xml配置
1 <?xml version="1.0" encoding="UTF-8"?> 2 <web-app version="2.4" 3 xmlns="http://java.sun.com/xml/ns/j2ee" 4 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 5 xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> 6 7 <servlet> 8 <servlet-name>springmvc</servlet-name> 9 <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> 10 11 <init-param> 12 <param-name>contextConfigLocation</param-name> 13 <param-value>classpath:config_ticket_ssm.xml</param-value> 14 </init-param> 15 </servlet> 16 17 <servlet-mapping> 18 <servlet-name>springmvc</servlet-name> 19 <url-pattern>/</url-pattern> 20 </servlet-mapping> 21 22 <!--中文乱码处理--> 23 <filter> 24 <filter-name>characterEncodingFilter</filter-name> 25 <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> 26 27 <init-param> 28 <param-name>encoding</param-name> 29 <param-value>UTF-8</param-value> 30 </init-param> 31 </filter> 32 <filter-mapping> 33 <filter-name>characterEncodingFilter</filter-name> 34 <url-pattern>/*</url-pattern> 35 </filter-mapping> 36 37 <!--配置druid监控链接地址--> 38 <servlet> 39 <servlet-name>druidStaView</servlet-name> 40 <servlet-class>com.alibaba.druid.support.http.StatViewServlet</servlet-class> 41 42 <init-param> 43 <param-name>resetEnable</param-name> 44 <param-value>true</param-value> 45 </init-param> 46 <init-param> 47 <param-name>loginUsername</param-name> 48 <param-value>jianhui</param-value> 49 </init-param> 50 <init-param> 51 <param-name>loginPassword</param-name> 52 <param-value>123</param-value> 53 </init-param> 54 </servlet> 55 <servlet-mapping> 56 <servlet-name>druidStaView</servlet-name> 57 <url-pattern>/druid/*</url-pattern> 58 </servlet-mapping> 59 60 <!--对站点进行url统计:webStatFilter用于统计web-jdbd关联监控的数据--> 61 <filter> 62 <filter-name>druidWebStatFilter</filter-name> 63 <filter-class>com.alibaba.druid.support.http.WebStatFilter</filter-class> 64 65 <!--排除一些不必要的url--> 66 <init-param> 67 <param-name>namespace</param-name> 68 <param-value>/public/*,*.js,*.css,/druid*,*.jsp,*.swf</param-value> 69 </init-param> 70 <!--监控Session信息--> 71 <init-param> 72 <param-name>principalSessionName</param-name> 73 <param-value>sessionInfo</param-value> 74 </init-param> 75 <!--druid 0.2.7版本开始支持profile,配置profileEnable能够监控单个url调用的sql列表--> 76 <init-param> 77 <param-name>profileEnable</param-name> 78 <param-value>true</param-value> 79 </init-param> 80 </filter> 81 <filter-mapping> 82 <filter-name>druidWebStatFilter</filter-name> 83 <url-pattern>/*</url-pattern> 84 </filter-mapping> 85 86 </web-app> 87
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 <generatorConfiguration> 6 <!--导入属性配置 --> 7 <properties resource="db.properties"></properties> 8 9 <!--指定特定数据库的jdbc驱动jar包的位置 --> 10 <classPathEntry location="${jdbc.driverLocation}"/> 11 12 <context id="default" targetRuntime="MyBatis3"> 13 14 <!--<!– optional,旨在创建class时,对注释进行控制 –>--> 15 <commentGenerator> 16 <property name="suppressDate" value="true"/> 17 </commentGenerator> 18 19 20 <!--jdbc的数据库连接 --> 21 <jdbcConnection driverClass="${mysql.driver}" connectionURL="${mysql.url}" userId="${mysql.username}" 22 password="${mysql.password}"> 23 </jdbcConnection> 24 25 26 <!-- 非必需,类型处理器,在数据库类型和java类型之间的转换控制--> 27 <javaTypeResolver> 28 <property name="forceBigDecimals" value="false"/> 29 </javaTypeResolver> 30 31 <!-- entity,用来生成含有主键key的类,记录类 以及查询Example类 32 targetPackage 指定生成的model生成所在的包名 33 targetProject 指定在该项目下所在的路径 34 --> 35 <javaModelGenerator targetPackage="com.kehong.entity" targetProject="src/main/java"> 36 <!-- 是否对model添加 构造函数 --> 37 <!--<property name="constructorBased" value="true"/>--> 38 39 <!-- 是否允许子包,即targetPackage.schemaName.tableName --> 40 <property name="enableSubPackages" value="false"/> 41 42 <!-- 建立的 entity对象是否 不可改变 即生成的entity对象不会有 setter方法,只有构造方法 --> 43 <!--<property name="immutable" value="true"/>--> 44 45 <!-- 是否对类CHAR类型的列的数据进行trim操作 --> 46 <property name="trimStrings" value="true"/> 47 </javaModelGenerator> 48 49 <!--Mapper映射文件生成所在的目录 为每一个数据库的表生成对应的SqlMap文件 --> 50 <!--<sqlMapGenerator targetPackage="mybatis-mapper" targetProject="src/main/resources">--> 51 <sqlMapGenerator targetPackage="mapper" targetProject="src/main/resources"> 52 <property name="enableSubPackages" value="false"/> 53 </sqlMapGenerator> 54 55 56 <!-- 客户端代码,生成易于使用的针对Model对象和XML配置文件 的代码 57 type="ANNOTATEDMAPPER",生成Java entity 和基于注解的Mapper对象 58 type="MIXEDMAPPER",生成基于注解的Java Model 和相应的Mapper对象 59 type="XMLMAPPER",生成SQLMap XML文件和独立的Mapper接口 60 --> 61 <!--Mapper.java所在的目录--> 62 <javaClientGenerator targetPackage="com.kehong.dao" targetProject="src/main/java" type="MIXEDMAPPER"> 63 <property name="enableSubPackages" value=""/> 64 <!-- 65 定义Maper.java 源代码中的ByExample() 方法的可视性,可选的值有: 66 public; 67 private; 68 protected; 69 default 70 注意:如果 targetRuntime="MyBatis3",此参数被忽略 71 --> 72 <property name="exampleMethodVisibility" value=""/> 73 <!-- 方法名计数器 74 Important note: this property is ignored if the target runtime is MyBatis3. --> 75 <property name="methodNameCalculator" value=""/> 76 77 <!-- 为生成的接口添加父接口 --> 78 <property name="rootInterface" value=""/> 79 80 </javaClientGenerator> 81 82 <!--配置要自动生成的实体的表的名称--> 83 <table tableName="emp" domainObjectName="Emp" 84 enableCountByExample="true" enableUpdateByExample="true" 85 enableDeleteByExample="true" enableSelectByExample="true" 86 selectByExampleQueryId="true"> 87 </table> 88 89 <table tableName="user" domainObjectName="User" 90 enableCountByExample="false" enableUpdateByExample="false" 91 enableDeleteByExample="false" enableSelectByExample="false" 92 selectByExampleQueryId="false"> 93 </table> 94 95 </context> 96 </generatorConfiguration>
properties配置
1 #配置数据库驱动 2 mysql.driver = com.mysql.jdbc.Driver 3 jdbc.driverLocation=D:/develop/apache/apache-maven-3.5.4/repository/mysql/mysql-connector-java/5.1.26/mysql-connector-java-5.1.26.jar 4 5 #url 6 mysql.url = jdbc:mysql://localhost:3306/ticket_ssm 7 #username 8 mysql.username = root 9 #password 10 mysql.password = admin 11 12 #配置初始化大小、最小、最大 13 mysql.initialSize = 10 14 mysql.minIdle = 1 15 mysql.maxActive = 10 16 17 # 配置获取连接等待超时的时间 18 mysql.maxWait = 1000 19 20 #开启druid防火墙(防止Sql注入) 21 mysql.filters = wall
pom.xml配置
1 <?xml version="1.0" encoding="UTF-8"?> 2 3 <project xmlns="http://maven.apache.org/POM/4.0.0" 4 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 5 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 6 7 8 <modelVersion>4.0.0</modelVersion> 9 <packaging>pom</packaging> 10 11 <name>day50empsys</name> 12 <!--<modules>--> 13 <!--<module>../ticket_integration_ssm</module>--> 14 <!--</modules>--> 15 <groupId>com.kehong</groupId> 16 <artifactId>day50empsys</artifactId> 17 <version>1.0-SNAPSHOT</version> 18 <properties> 19 <file.encoding>UTF-8</file.encoding> 20 <spring.version>5.0.8.RELEASE</spring.version> 21 </properties> 22 23 <dependencies> 24 <!--文件上传下载相关--> 25 <!-- https://mvnrepository.com/artifact/commons-fileupload/commons-fileupload --> 26 <dependency> 27 <groupId>commons-fileupload</groupId> 28 <artifactId>commons-fileupload</artifactId> 29 <version>1.3.3</version> 30 </dependency> 31 <!-- https://mvnrepository.com/artifact/commons-io/commons-io --> 32 <dependency> 33 <groupId>commons-io</groupId> 34 <artifactId>commons-io</artifactId> 35 <version>2.6</version> 36 </dependency> 37 <!-- https://mvnrepository.com/artifact/commons-logging/commons-logging --> 38 <dependency> 39 <groupId>commons-logging</groupId> 40 <artifactId>commons-logging</artifactId> 41 <version>1.2</version> 42 </dependency> 43 <!-- https://mvnrepository.com/artifact/com.alibaba/druid --> 44 <dependency> 45 <groupId>com.alibaba</groupId> 46 <artifactId>druid</artifactId> 47 <version>1.1.10</version> 48 </dependency> 49 <!-- https://mvnrepository.com/artifact/javax.el/javax.el-api --> 50 <dependency> 51 <groupId>javax.el</groupId> 52 <artifactId>javax.el-api</artifactId> 53 <version>3.0.1-b06</version> 54 </dependency> 55 <!-- https://mvnrepository.com/artifact/javax.inject/javax.inject --> 56 <dependency> 57 <groupId>javax.inject</groupId> 58 <artifactId>javax.inject</artifactId> 59 <version>1</version> 60 <!-- https://mvnrepository.com/artifact/javax.servlet/jsp-api --> 61 </dependency> 62 <!-- https://mvnrepository.com/artifact/javax.servlet/jsp-api --> 63 <dependency> 64 <groupId>javax.servlet</groupId> 65 <artifactId>jsp-api</artifactId> 66 <version>2.0</version> 67 <scope>provided</scope> 68 </dependency> 69 70 <!-- https://mvnrepository.com/artifact/javax.servlet.jsp.jstl/jstl --> 71 <dependency> 72 <groupId>javax.servlet.jsp.jstl</groupId> 73 <artifactId>jstl</artifactId> 74 <version>1.2</version> 75 </dependency> 76 <!-- https://mvnrepository.com/artifact/log4j/log4j --> 77 <dependency> 78 <groupId>log4j</groupId> 79 <artifactId>log4j</artifactId> 80 <version>1.2.17</version> 81 </dependency> 82 <!-- https://mvnrepository.com/artifact/org.mybatis/mybatis --> 83 <dependency> 84 <groupId>org.mybatis</groupId> 85 <artifactId>mybatis</artifactId> 86 <version>3.4.6</version> 87 </dependency> 88 <!-- https://mvnrepository.com/artifact/org.mybatis/mybatis-spring --> 89 <dependency> 90 <groupId>org.mybatis</groupId> 91 <artifactId>mybatis-spring</artifactId> 92 <version>1.3.2</version> 93 </dependency> 94 <!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java --> 95 <dependency> 96 <groupId>mysql</groupId> 97 <artifactId>mysql-connector-java</artifactId> 98 <version>5.1.26</version> 99 </dependency> 100 <!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api --> 101 <dependency> 102 <groupId>javax.servlet</groupId> 103 <artifactId>javax.servlet-api</artifactId> 104 <version>4.0.1</version> 105 <scope>provided</scope> 106 </dependency> 107 108 <!-- https://mvnrepository.com/artifact/org.springframework/spring-core --> 109 <dependency> 110 <groupId>org.springframework</groupId> 111 <artifactId>spring-core</artifactId> 112 <version>${spring.version}</version> 113 </dependency> 114 <dependency> 115 <groupId>org.springframework</groupId> 116 <artifactId>spring-context</artifactId> 117 <version>${spring.version}</version> 118 </dependency> 119 120 <dependency> 121 <groupId>org.springframework</groupId> 122 <artifactId>spring-tx</artifactId> 123 <version>${spring.version}</version> 124 </dependency> 125 126 <dependency> 127 <groupId>org.springframework</groupId> 128 <artifactId>spring-oxm</artifactId> 129 <version>${spring.version}</version> 130 </dependency> 131 132 <dependency> 133 <groupId>org.springframework</groupId> 134 <artifactId>spring-aop</artifactId> 135 <version>${spring.version}</version> 136 </dependency> 137 138 <dependency> 139 <groupId>org.springframework</groupId> 140 <artifactId>spring-jdbc</artifactId> 141 <version>${spring.version}</version> 142 </dependency> 143 144 <dependency> 145 <groupId>org.springframework</groupId> 146 <artifactId>spring-web</artifactId> 147 <version>${spring.version}</version> 148 </dependency> 149 150 <dependency> 151 <groupId>org.springframework</groupId> 152 <artifactId>spring-webmvc</artifactId> 153 <version>${spring.version}</version> 154 </dependency> 155 156 <dependency> 157 <groupId>org.springframework</groupId> 158 <artifactId>spring-context-support</artifactId> 159 <version>${spring.version}</version> 160 </dependency> 161 162 <dependency> 163 <groupId>org.springframework</groupId> 164 <artifactId>spring-test</artifactId> 165 <version>${spring.version}</version> 166 </dependency> 167 <dependency> 168 <groupId>org.springframework</groupId> 169 <artifactId>spring-orm</artifactId> 170 <version>${spring.version}</version> 171 </dependency> 172 <dependency> 173 <groupId>junit</groupId> 174 <artifactId>junit</artifactId> 175 <version>4.12</version> 176 <scope>test</scope> 177 </dependency> 178 </dependencies> 179 180 181 182 <!--<!–解决maven 找不到mapper映射文件:放在resoyrses里面不用配置–>--> 183 <build> 184 <!--<resources>--> 185 <!--<resource>--> 186 <!--<directory>mapper</directory>--> 187 <!--<includes>--> 188 <!--<include>**/*.properties</include>--> 189 <!--<include>**/*.xml</include>--> 190 <!--</includes>--> 191 <!--<filtering>false</filtering>--> 192 <!--</resource>--> 193 194 <!--<resource>--> 195 <!--<directory>src/main/resources</directory>--> 196 <!--<includes>--> 197 <!--<include>**/*.properties</include>--> 198 <!--<include>**/*.xml</include>--> 199 <!--</includes>--> 200 <!--</resource>--> 201 <!--</resources>--> 202 203 <pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) --> 204 <plugins> 205 <plugin> 206 <groupId>org.mybatis.generator</groupId> 207 <artifactId>mybatis-generator-maven-plugin</artifactId> 208 <version>1.3.2</version> 209 <configuration> 210 <verbose>true</verbose> 211 <overwrite>true</overwrite> 212 </configuration> 213 </plugin> 214 </plugins> 215 </pluginManagement> 216 </build> 217 218 </project>
创建maven时注意:
标签:最大 count ext 特定 man aging filters 超时 大小
原文地址:https://www.cnblogs.com/jhcq/p/9472616.html