Skip to content

Commit 1c2240a

Browse files
committed
升级SpringBoot2.1
1 parent 5ce740f commit 1c2240a

File tree

8 files changed

+29
-22
lines changed

8 files changed

+29
-22
lines changed

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# SpringBootGenerator(SpringBoot2.0版)
1+
# SpringBootGenerator(SpringBoot2.1版)
22

3-
> SpringBoot2.0版(SpringBoot1.5版切换分支(springboot1.5))
3+
> SpringBoot2.1版(SpringBoot1.5版切换分支(springboot1.5))
44
> 参考:[https://github.com/lihengming/spring-boot-api-project-seed](https://github.com/lihengming/spring-boot-api-project-seed)
55
66
### 项目相关
@@ -37,6 +37,12 @@ SpringBoot + Mybatis + PageHelper + 通用Mapper
3737
1. 可以自行修改src\test\resources\template下的模板
3838
2. 修改src\test\java\com\example\generator\CodeGenerator.java下的CONTROLLER_TYPE可以生成REST或者POST的Controller模板
3939

40+
#### SpringBoot1.5升级2.1
41+
42+
* SpringBoot官方文档:[https://docs.spring.io/spring-boot/docs/2.1.1.RELEASE/reference/htmlsingle/#common-application-properties](https://docs.spring.io/spring-boot/docs/2.1.1.RELEASE/reference/htmlsingle/#common-application-properties)
43+
* 感谢清风丿自来的java.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized:[https://blog.csdn.net/qq_39098813/article/details/81138648](https://blog.csdn.net/qq_39098813/article/details/81138648)
44+
* 感谢不信成不了大牛的Loading class 'com.mysql.jdbc.Driver'. This is deprecated. The new driver class is 'com.mysql.cj.jdb:[https://blog.csdn.net/anaini1314/article/details/71157791](https://blog.csdn.net/anaini1314/article/details/71157791)
45+
4046
#### 参与贡献
4147

4248
1. Fork 本项目

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<parent>
1515
<groupId>org.springframework.boot</groupId>
1616
<artifactId>spring-boot-starter-parent</artifactId>
17-
<version>1.5.16.RELEASE</version>
17+
<version>2.1.1.RELEASE</version>
1818
<relativePath/> <!-- lookup parent from repository -->
1919
</parent>
2020

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
spring:
22
datasource:
33
name: dev
4-
url: jdbc:mysql://127.0.0.1:3306/dev?useSSL=false&useUnicode=true&characterEncoding=UTF-8
4+
url: jdbc:mysql://127.0.0.1:3306/dev?serverTimezone=GMT%2B8&useSSL=false&useUnicode=true&characterEncoding=UTF-8
55
username: root
66
password: root
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
spring:
22
datasource:
33
name: prod
4-
url: jdbc:mysql://127.0.0.1:3306/prod?useSSL=false&useUnicode=true&characterEncoding=UTF-8
4+
url: jdbc:mysql://127.0.0.1:3306/prod?serverTimezone=GMT%2B8&useSSL=false&useUnicode=true&characterEncoding=UTF-8
55
username: root
66
password: root
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
spring:
22
datasource:
33
name: sit
4-
url: jdbc:mysql://127.0.0.1:3306/sit?useSSL=false&useUnicode=true&characterEncoding=UTF-8
4+
url: jdbc:mysql://127.0.0.1:3306/sit?serverTimezone=GMT%2B8&useSSL=false&useUnicode=true&characterEncoding=UTF-8
55
username: root
66
password: root
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
spring:
22
datasource:
33
name: uat
4-
url: jdbc:mysql://127.0.0.1:3306/uat?useSSL=false&useUnicode=true&characterEncoding=UTF-8
4+
url: jdbc:mysql://127.0.0.1:3306/uat?serverTimezone=GMT%2B8&useSSL=false&useUnicode=true&characterEncoding=UTF-8
55
username: root
66
password: root

src/main/resources/application.yml

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,21 @@ spring:
88
# 使用Druid数据源
99
datasource:
1010
type: com.alibaba.druid.pool.DruidDataSource
11-
driver-class-name: com.mysql.jdbc.Driver
12-
filters: stat
13-
maxActive: 20
14-
initialSize: 1
15-
maxWait: 60000
16-
minIdle: 1
17-
timeBetweenEvictionRunsMillis: 60000
18-
minEvictableIdleTimeMillis: 300000
19-
validationQuery: select 'x'
20-
testWhileIdle: true
21-
testOnBorrow: false
22-
testOnReturn: false
23-
poolPreparedStatements: true
24-
maxOpenPreparedStatements: 20
11+
driver-class-name: com.mysql.cj.jdbc.Driver
12+
druid:
13+
filters: stat
14+
maxActive: 20
15+
initialSize: 1
16+
maxWait: 60000
17+
minIdle: 1
18+
timeBetweenEvictionRunsMillis: 60000
19+
minEvictableIdleTimeMillis: 300000
20+
validationQuery: select 'x'
21+
testWhileIdle: true
22+
testOnBorrow: false
23+
testOnReturn: false
24+
poolPreparedStatements: true
25+
maxOpenPreparedStatements: 20
2526
# 404交给异常处理器处理
2627
mvc:
2728
throw-exception-if-no-handler-found: true

src/test/java/com/example/generator/CodeGenerator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public static void genModelAndMapper(String tableName, String modelName) {
150150
generator = new MyBatisGenerator(config, callback, warnings);
151151
generator.generate(null);
152152
} catch (Exception e) {
153-
throw new RuntimeException("生成Model和Mapper失败", e);
153+
throw new RuntimeException("生成Model和Mapper失败(请检查数据库是否连接正常及表名是否正确以及权限是否缺失)", e);
154154
}
155155

156156
if (generator.getGeneratedJavaFiles().isEmpty() || generator.getGeneratedXmlFiles().isEmpty()) {

0 commit comments

Comments
 (0)