Commit f187426fc609db2126d922c7b486689aa5980206

Authored by mahuandong
2 parents 3a64af6f 3cdea063

Merge remote-tracking branch 'origin/develop' into develop

... ... @@ -55,7 +55,31 @@
55 55 -->
56 56 </dependency>
57 57  
58   - <!-- SpringBoot 测试 -->
  58 + <!-- 下面的配置将使用undertow来做web容器而不是tomcat -->
  59 + <!--移除Tomcat依赖-->
  60 + <dependency>
  61 + <groupId>org.springframework.boot</groupId>
  62 + <artifactId>spring-boot-starter-web</artifactId>
  63 + <exclusions>
  64 + <exclusion>
  65 + <groupId>org.springframework.boot</groupId>
  66 + <artifactId>spring-boot-starter-tomcat</artifactId>
  67 + </exclusion>
  68 + </exclusions>
  69 + </dependency>
  70 + <!--引入undertow-->
  71 + <dependency>
  72 + <groupId>org.springframework.boot</groupId>
  73 + <artifactId>spring-boot-starter-undertow</artifactId>
  74 + </dependency>
  75 +
  76 + <!-- SpringBoot tomcat Web容器 -->
  77 + <!--<dependency>
  78 + <groupId>org.springframework.boot</groupId>
  79 + <artifactId>spring-boot-starter-web</artifactId>
  80 + </dependency>-->
  81 +
  82 + <!-- SpringBoot 测试 -->
59 83 <dependency>
60 84 <groupId>org.springframework.boot</groupId>
61 85 <artifactId>spring-boot-starter-test</artifactId>
... ... @@ -68,24 +92,6 @@
68 92 <artifactId>spring-boot-starter-aop</artifactId>
69 93 </dependency>
70 94  
71   - <!-- SpringBoot Web容器 -->
72   - <dependency>
73   - <groupId>org.springframework.boot</groupId>
74   - <artifactId>spring-boot-starter-web</artifactId>
75   - <exclusions>
76   - <exclusion>
77   - <groupId>org.springframework.boot</groupId>
78   - <artifactId>spring-boot-starter-tomcat</artifactId>
79   - </exclusion>
80   - </exclusions>
81   - </dependency>
82   -
83   - <!--引入undertow-->
84   - <dependency>
85   - <groupId>org.springframework.boot</groupId>
86   - <artifactId>spring-boot-starter-undertow</artifactId>
87   - </dependency>
88   -
89 95 <!-- SpringBoot集成thymeleaf模板 -->
90 96 <dependency>
91 97 <groupId>org.springframework.boot</groupId>
... ... @@ -105,12 +111,6 @@
105 111 <artifactId>nekohtml</artifactId>
106 112 </dependency>
107 113  
108   - <!-- Mysql驱动包 -->
109   - <!--<dependency>
110   - <groupId>mysql</groupId>
111   - <artifactId>mysql-connector-java</artifactId>
112   - </dependency>-->
113   -
114 114 <!-- Mysql8驱动包 -->
115 115 <dependency>
116 116 <groupId>mysql</groupId>
... ... @@ -205,12 +205,12 @@
205 205 <groupId>org.quartz-scheduler</groupId>
206 206 <artifactId>quartz</artifactId>
207 207 <version>2.3.1</version>
208   - <exclusions>
  208 + <!--<exclusions>
209 209 <exclusion>
210 210 <groupId>com.mchange</groupId>
211 211 <artifactId>c3p0</artifactId>
212 212 </exclusion>
213   - </exclusions>
  213 + </exclusions>-->
214 214 </dependency>
215 215  
216 216 <!--velocity代码生成使用模板 -->
... ... @@ -297,21 +297,8 @@
297 297 <artifactId>groovy-all</artifactId>
298 298 <version>2.4.11</version>
299 299 </dependency>
300   - <!-- 添加jedis客户端 -->
301   - <dependency>
302   - <groupId>redis.clients</groupId>
303   - <artifactId>jedis</artifactId>
304   - </dependency>
305   -
306   - <!--spring2.0集成redis所需common-pool2-->
307   - <!-- 必须加上,jedis依赖此 -->
308   - <dependency>
309   - <groupId>org.apache.commons</groupId>
310   - <artifactId>commons-pool2</artifactId>
311   - <version>2.5.0</version>
312   - </dependency>
313 300  
314   - <!-- 将作为Redis对象序列化器 -->
  301 + <!-- 对象序列化器json库 -->
315 302 <dependency>
316 303 <groupId>com.alibaba</groupId>
317 304 <artifactId>fastjson</artifactId>
... ... @@ -339,12 +326,6 @@
339 326 <version>2.8.2</version>
340 327 </dependency>
341 328  
342   - <!-- <dependency>
343   - <groupId>com.huaheng.soft</groupId>
344   - <artifactId>echarts</artifactId>
345   - <version>1.1</version>
346   - </dependency>-->
347   -
348 329 <dependency>
349 330 <groupId>com.github.abel533</groupId>
350 331 <artifactId>ECharts</artifactId>
... ... @@ -410,20 +391,56 @@
410 391 <artifactId>javase</artifactId>
411 392 <version>3.3.0</version>
412 393 </dependency>
413   - </dependencies>
414   -
415   - <build>
416   - <finalName>${project.artifactId}-${maven.build.timestamp}</finalName>
417   - <plugins>
418   - <plugin>
419   - <groupId>org.springframework.boot</groupId>
420   - <artifactId>spring-boot-maven-plugin</artifactId>
421   - <configuration>
422   - <fork>true</fork> <!-- 如果没有该配置,devtools不会生效 -->
423   - </configuration>
424   - </plugin>
425   - </plugins>
426   - </build>
  394 +
  395 +
  396 + <!--打war包-->
  397 + <!--&lt;!&ndash;servlet依赖&ndash;&gt;
  398 + <dependency>
  399 + <groupId>javax.servlet</groupId>
  400 + <artifactId>javax.servlet-api</artifactId>
  401 + <version>4.0.0</version>
  402 + <scope>provided</scope>
  403 + </dependency>-->
  404 + <!--打war包-->
  405 +
  406 + </dependencies>
  407 +
  408 + <!--maver相关-->
  409 + <build>
  410 + <finalName>${project.artifactId}-${maven.build.timestamp}</finalName>
  411 + <plugins>
  412 + <plugin>
  413 + <groupId>org.springframework.boot</groupId>
  414 + <artifactId>spring-boot-maven-plugin</artifactId>
  415 + <configuration>
  416 + <fork>true</fork> <!-- 如果没有该配置,devtools不会生效 -->
  417 + </configuration>
  418 + </plugin>
  419 +
  420 + <!--打war包-->
  421 + <!--<plugin>
  422 + <groupId>org.apache.maven.plugins</groupId>
  423 + <artifactId>maven-war-plugin</artifactId>
  424 + <version>3.1.0</version>
  425 + <configuration>
  426 + <failOnMissingWebXml>false</failOnMissingWebXml>
  427 + </configuration>
  428 + </plugin>
  429 +
  430 + <plugin>
  431 + <groupId>org.apache.maven.plugins</groupId>
  432 + <artifactId>maven-compiler-plugin</artifactId>
  433 + <version>3.1</version>
  434 + <configuration>
  435 + <source>1.8</source>&lt;!&ndash;这里版本需和服务器版本保持一致&ndash;&gt;
  436 + <target>1.8</target>
  437 + </configuration>
  438 + </plugin>-->
  439 + <!--打war包-->
  440 +
  441 + </plugins>
  442 + </build>
  443 +
427 444  
428 445 <!--阿里maven地址-->
429 446 <repositories>
... ...
src/main/java/com/huaheng/HuaHengApplication.java
... ... @@ -4,6 +4,9 @@ import org.mybatis.spring.annotation.MapperScan;
4 4 import org.springframework.boot.SpringApplication;
5 5 import org.springframework.boot.autoconfigure.SpringBootApplication;
6 6 import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
  7 +import org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory;
  8 +import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
  9 +import org.springframework.context.annotation.Bean;
7 10  
8 11 /**
9 12 * 启动程序
... ... @@ -15,12 +18,19 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
15 18 @SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
16 19 public class HuaHengApplication
17 20 {
  21 +
  22 + @Bean // 此处相当于将undertow server注入到spring-context 中,这里相对于tomcat设置要多此动作
  23 + public ServletWebServerFactory servletContainer() {
  24 + UndertowServletWebServerFactory undertow = new UndertowServletWebServerFactory();
  25 + return undertow;
  26 + }
  27 +
18 28 public static void main(String[] args)
19 29 {
20 30 // System.setProperty("spring.devtools.restart.enabled", "false");
21 31 SpringApplication.run(HuaHengApplication.class, args);
22   - System.out.println("*************** 华恒WMS启动成功 ***************\n" +
23   - " >>> WMS启动成功! <<< \n"+
  32 + System.out.println("*************** 华恒WMS启动成功JAR ***************\n" +
  33 + " >>> WMS启动成功JAR! <<< \n"+
24 34 "   へ     /|▓\n"+
25 35 "   /\7   ∠_/\n"+
26 36 "  / │   / /\n"+
... ...
src/main/java/com/huaheng/HuaHengServletInitializer.java
1 1 package com.huaheng;
2 2  
  3 +import org.mybatis.spring.annotation.MapperScan;
  4 +import org.springframework.boot.SpringApplication;
  5 +import org.springframework.boot.autoconfigure.SpringBootApplication;
  6 +import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
3 7 import org.springframework.boot.builder.SpringApplicationBuilder;
  8 +import org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory;
  9 +import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
4 10 import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
  11 +import org.springframework.context.annotation.Bean;
5 12  
6 13 /**
7 14 * web容器中进行部署
8   - *
  15 + * 打war包
9 16 * @author huaheng
10 17 */
  18 +/*@MapperScan({"com.huaheng.pc.**.**.mapper","com.huaheng.api.**.**.mapper"})//打war包去掉注释
  19 +//添加SecurityAutoConfiguration.class,防止报java.lang.ArrayStoreException错
  20 +@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })*/
11 21 public class HuaHengServletInitializer extends SpringBootServletInitializer
12 22 {
  23 + @Bean // 此处相当于将undertow server注入到spring-context 中,这里相对于tomcat设置要多此动作
  24 + public ServletWebServerFactory servletContainer() {
  25 + UndertowServletWebServerFactory undertow = new UndertowServletWebServerFactory();
  26 + return undertow;
  27 + }
  28 +
13 29 @Override
14 30 protected SpringApplicationBuilder configure(SpringApplicationBuilder application)
15 31 {
16 32 return application.sources(HuaHengServletInitializer.class);
17 33 }
18 34  
  35 + public static void main(String[] args)
  36 + {
  37 + SpringApplication.run(HuaHengApplication.class, args);
  38 + System.out.println("*************** 华恒WMS启动成功WAR ***************\n" +
  39 + " >>> WMS_Servlet启动成功! <<< \n"+
  40 + "   へ     /|▓\n"+
  41 + "   /\7   ∠_/\n"+
  42 + "  / │   / /\n"+
  43 + "  │ Z _,< /  〈ヽ\n"+
  44 + "  │ `   ヽ   / 〉\n"+
  45 + "   Y     `/  / 〉\n"+
  46 + "  ( ●  ヽ  ● /. 〈 /\n"+
  47 + "  () (  | \ 〈 \\n"+
  48 + "   >_ ' _ . '│ //\n"+
  49 + "  /へ   / )<| \\\n"+
  50 + "  ヽ_)  (_/  │//\n"+
  51 + "   7       | /\n"+
  52 + " >―r` ̄ ̄` `―_' \n"
  53 +
  54 + );
  55 + }
  56 +
19 57 }
... ...
src/main/resources/application-dev.yml
... ... @@ -66,4 +66,11 @@ logging:
66 66 server:
67 67 port: 8888
68 68 servlet:
69   - context-path: /wms/
70 69 \ No newline at end of file
  70 + context-path: /wms/
  71 +
  72 +
  73 +#文件上传
  74 +multipart:
  75 + enabled: true
  76 + max-file-size: 3MB
  77 + max-request-size: 3MB
71 78 \ No newline at end of file
... ...
src/main/resources/application-druid.properties
1   -#\u6570\u636E\u6E90\u914D\u7F6E
  1 +#数据源配置
2 2 spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
3 3 spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
4   -# \u4E3B\u5E93
  4 +# 主库
5 5 spring.datasource.druid.master.url=jdbc:mysql://172.16.29.45:3306/wms_v2?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2b8
6 6 #spring.datasource.druid.master.url=jdbc:mysql://172.16.29.45:3306/huahengExample?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false
7 7 #spring.datasource.druid.master.url=jdbc:mysql://localhost:3306/wms2.0?characterEncoding=utf8&serverTimezone=GMT%2b8
... ... @@ -10,25 +10,25 @@ spring.datasource.druid.master.username=softhuaheng
10 10 spring.datasource.druid.master.password=HHrobot123.
11 11 #spring.datasource.druid.master.username=root
12 12 #spring.datasource.druid.master.password=123456
13   -# \u4ECE\u5E93
14   -#spring.datasource.druid.slave.open = true
15   -#spring.datasource.druid.slave.url=jdbc:mysql://172.16.29.45:3306/huaheng?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false
  13 +# 从库
  14 +spring.datasource.druid.slave.open = true
  15 +spring.datasource.druid.slave.url=jdbc:mysql://199.19.109.117:3306/wms_v2?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false
16 16 #spring.datasource.druid.master.username=softhuaheng
17 17 #spring.datasource.druid.master.password=HHrobot123.
18   -# \u521D\u59CB\u8FDE\u63A5\u6570
  18 +# 初始连接数
19 19 spring.datasource.druid.initial-size=10
20   -# \u6700\u5927\u8FDE\u63A5\u6C60\u6570\u91CF
  20 +# 最大连接池数量
21 21 spring.datasource.druid.max-active=100
22   -# \u6700\u5C0F\u8FDE\u63A5\u6C60\u6570\u91CF
  22 +# 最小连接池数量
23 23 spring.datasource.druid.min-idle=10
24   -# \u914D\u7F6E\u83B7\u53D6\u8FDE\u63A5\u7B49\u5F85\u8D85\u65F6\u7684\u65F6\u95F4
  24 +# 配置获取连接等待超时的时间
25 25 spring.datasource.druid.max-wait=60000
26   -# \u6253\u5F00PSCache\uFF0C\u5E76\u4E14\u6307\u5B9A\u6BCF\u4E2A\u8FDE\u63A5\u4E0APSCache\u7684\u5927\u5C0F
  26 +# 打开PSCache,并且指定每个连接上PSCache的大小
27 27 spring.datasource.druid.pool-prepared-statements=true
28 28 spring.datasource.druid.max-pool-prepared-statement-per-connection-size=20
29   -# \u914D\u7F6E\u95F4\u9694\u591A\u4E45\u624D\u8FDB\u884C\u4E00\u6B21\u68C0\u6D4B\uFF0C\u68C0\u6D4B\u9700\u8981\u5173\u95ED\u7684\u7A7A\u95F2\u8FDE\u63A5\uFF0C\u5355\u4F4D\u662F\u6BEB\u79D2
  29 +# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
30 30 spring.datasource.druid.timeBetweenEvictionRunsMillis=60000
31   -# \u914D\u7F6E\u4E00\u4E2A\u8FDE\u63A5\u5728\u6C60\u4E2D\u6700\u5C0F\u751F\u5B58\u7684\u65F6\u95F4\uFF0C\u5355\u4F4D\u662F\u6BEB\u79D2
  31 +# 配置一个连接在池中最小生存的时间,单位是毫秒
32 32 spring.datasource.druid.min-evictable-idle-time-millis=300000
33 33 spring.datasource.druid.validation-query=SELECT 1 FROM DUAL
34 34 spring.datasource.druid.test-while-idle=true
... ... @@ -42,11 +42,10 @@ spring.datasource.druid.filter.stat.merge-sql=false
42 42 spring.datasource.druid.filter.wall.config.multi-statement-allow=true
43 43  
44 44  
45   -#\u65E5\u5FD7\u914D\u7F6E
  45 +#日志配置
46 46 logging.level.com.huaheng=debug
47 47 logging.level.org.springframework=warn
48 48 logging.level.spring.springboot.dao=DEBUG
49 49  
50   -#\u6D4B\u8BD5\u670D\u52A1\u7AEF\u53E3\u3001\u6D4B\u8BD5\u9879\u76EEcontextPath
51   -server.port= 8888
52   -server.servlet.context-path= /wms2.0/
  50 +#测试服务端口、测试项目contextPath
  51 +
... ...
src/main/resources/application-prd.yml
... ... @@ -6,7 +6,7 @@ spring:
6 6 druid:
7 7 # 主库
8 8 master:
9   - url: jdbc:mysql://localhost:3306/xinyi_wms?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2b8&allowPublicKeyRetrieval=true
  9 + url: jdbc:mysql://localhost:3306/wms_v2?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2b8&allowPublicKeyRetrieval=true
10 10 username: root
11 11 password: 123456
12 12 # 从库
... ... @@ -66,4 +66,10 @@ logging:
66 66 server:
67 67 port: 8888
68 68 servlet:
69   - context-path: /twms/
70 69 \ No newline at end of file
  70 + context-path: /twms/
  71 +
  72 +#文件上传
  73 +multipart:
  74 + enabled: true
  75 + max-file-size: 3MB
  76 + max-request-size: 3MB
71 77 \ No newline at end of file
... ...