forked from t-hong/springboot-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpom.xml
More file actions
150 lines (133 loc) · 6.47 KB
/
pom.xml
File metadata and controls
150 lines (133 loc) · 6.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.hong</groupId>
<artifactId>springboot-parent</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<modules>
<module>chapter1</module>
<module>chapter2</module>
<module>chapter3</module>
<module>chapter3-jersey</module>
<module>chapter4-thymeleaf</module>
<module>chapter4-freemarker</module>
<module>chapter4-velocity</module>
<module>chapter4-jsp</module>
<module>chapter5-swagger</module>
<module>chapter5-task</module>
<module>chapter6-handle-exception</module>
<module>chapter6-servlet</module>
<module>chapter6-aop-log</module>
<module>chapter7-spring-data-jpa</module>
<module>chapter7-jdbctemplate</module>
<module>chapter7-mybatis</module>
<module>chapter7-mybatis-mapper-plugin</module>
<module>chapter8-jdbctemplate-mutil-datasource</module>
<module>chapter8-mybatis-mutil-datasource</module>
<module>chapter8-jpa-mutil-datasource</module>
<module>chapter9-redis</module>
<module>chapter9-redis-cache</module>
<module>chapter9-redis-cluster</module>
<module>chapter9-redis-session</module>
<module>chapter10-jwt</module>
<module>chapter10-shiro</module>
<module>chapter10-security</module>
<module>chapter10-security-jwt</module>
<module>chapter10-security-oauth2.0</module>
<module>chapter11-caching-ehcache</module>
<module>chapter11-caching-redis</module>
<module>chapter12-rocketmq</module>
<module>chapter13-dubbo</module>
</modules>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<!--spring boot 父依赖-->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.3.RELEASE</version>
<relativePath/> <!--lookup parent from repository-->
</parent>
<dependencies>
<!-- 核心模块,包括自动配置支持、日志和YAML -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<!-- Spring Boot在所有内部日志中使用Commons Logging,我们其使用其他日志时,需要在spring-boot-starter依赖上 exclusions来排除不需要的依赖。-->
<!--<exclusions>-->
<!--<exclusion>-->
<!--<groupId>org.springframework.boot</groupId>-->
<!--<artifactId>spring-boot-starter-logging</artifactId>-->
<!--</exclusion>-->
<!--</exclusions>-->
</dependency>
<!--提供的对应用系统的自省和监控的集成功能.-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- 测试模块,包括JUnit、Hamcrest、Mockito -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!--引入Web模块-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!--mysql 连接驱动-->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<!--
devtools可以实现页面热部署(即页面修改后会立即生效,这个可以直接在application.properties文件中配置spring.thymeleaf.cache=false来实现),
实现类文件热部署(类文件修改后不会立即生效),实现对属性文件的热部署。
即devtools会监听classpath下的文件变动,并且会立即重启应用(发生在保存时机),注意:因为其采用的虚拟机机制,该项重启是很快的
在使用mybatis mapper插件:mapper-spring-boot-starter 时,需要做如下处理才支持
DevTools 默认会对 IDE 中引入的所有项目使用 restart 类加载器,对于引入的 jar 包使用 base 类加载器,因此只要保证通用Mapper的jar包使用 restart 类加载器即可。
在 src/main/resources 中创建 META-INF 目录,在此目录下添加 spring-devtools.properties 配置,内容如下:
restart.include.mapper=/mapper-[\\w-\\.]+jar
restart.include.pagehelper=/pagehelper-[\\w-\\.]+jar
-->
<!--<dependency>-->
<!--<groupId>org.springframework.boot</groupId>-->
<!--<artifactId>spring-boot-devtools</artifactId>-->
<!--<optional>true</optional>-->
<!--</dependency>-->
</dependencies>
<build>
<plugins>
<!--spring boot maven 插件-->
<!--
用于将应用打成可直接运行的jar(该jar就是用于生产环境中的jar) 值得注意的是,如果没有引用spring-boot-starter-parent做parent,
且采用了上述的第二种方式,这里也要做出相应的改动
-->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<jvmArguments>-Dfile.encoding=UTF-8</jvmArguments>
<!--fork : 如果没有该项配置,肯呢个devtools不会起作用,即应用不会restart -->
<fork>true</fork>
</configuration>
</plugin>
<!-- 使用maven 编译时,指定jdk版本. -->
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>