共计 5345 个字符,预计需要花费 14 分钟才能阅读完成。
咱们先从搭建通用服务开始,首先沟通 maven 创立 commonservice 的根我的项目,外面有一些根底的配置信息,如:版本控制、打包、编译、依赖、通用包配置、模块等,我间接将代码帖进来,心愿大家可能了解的更到位:(企业架构源码能够加求球:三五三六二四七二五九)
1. <span style="font-size: 16px;"><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3. <modelVersion>4.0.0</modelVersion>
4. <groupId>com.honghu.cloud</groupId>
5. <artifactId>commonservice</artifactId>
6. <version>2.0</version>
7. <packaging>pom</packaging>
9. <modules>
10. <module>commonservice-eureka</module>
11. <module>commonservice-config</module>
12. <module>commonservice-gateway</module>
13. <module>commonservice-oauth</module>
14. <module>commonservice-monitor</module>
15. <module>commonservice-turbine</module>
16. <module>commonservice-admin</module>
17. <module>commonservice-log</module>
18. <module>commonservice-file</module>
19. <module>commonservice-notification</module>
20. <module>commonservice-sequence</module>
21. </modules>
23. <parent>
24. <groupId>org.springframework.boot</groupId>
25. <artifactId>spring-boot-starter-parent</artifactId>
26. <version>2.0.4.RELEASE</version>
27. </parent>
29. <properties>
30. <spring-cloud.version>Finchley.RELEASE</spring-cloud.version>
31. <mybatis.version>1.3.2</mybatis.version>
32. <jwt.version>0.9.0</jwt.version>
33. <fastjson.version>1.2.47</fastjson.version>
34. <commons-collections>4.1</commons-collections>
35. <monitor.version>2.0.2</monitor.version>
36. <swagger.version>2.8.0</swagger.version>
37. <aliyun-sdk-oss.version>2.8.2</aliyun-sdk-oss.version>
38. <aliyun-sdk-core.version>3.2.8</aliyun-sdk-core.version>
39. <aliyun-sdk-dysmsapi.version>1.1.0</aliyun-sdk-dysmsapi.version>
40. <elasticsearch.version>6.2.3</elasticsearch.version>
41. <security-oauth2.version>2.3.3.RELEASE</security-oauth2.version>
42. <docker.image.prefix>springboot</docker.image.prefix>
43. </properties>
45. <dependencies>
46. <dependency>
47. <groupId>org.springframework.boot</groupId>
48. <artifactId>spring-boot-starter-actuator</artifactId>
49. </dependency>
50. <dependency>
51. <groupId>org.springframework.boot</groupId>
52. <artifactId>spring-boot-starter-test</artifactId>
53. <scope>test</scope>
54. </dependency>
55. <dependency>
56. <groupId>org.projectlombok</groupId>
57. <artifactId>lombok</artifactId>
58. </dependency>
59. <dependency>
60. <groupId>com.alibaba</groupId>
61. <artifactId>fastjson</artifactId>
62. <version>${fastjson.version}</version>
63. </dependency>
64. <dependency>
65. <groupId>org.apache.commons</groupId>
66. <artifactId>commons-lang3</artifactId>
67. </dependency>
68. <dependency>
69. <groupId>org.apache.commons</groupId>
70. <artifactId>commons-collections4</artifactId>
71. <version>${commons-collections}</version>
72. </dependency>
73. </dependencies>
75. <dependencyManagement>
76. <dependencies>
77. <dependency>
78. <groupId>org.springframework.cloud</groupId>
79. <artifactId>spring-cloud-dependencies</artifactId>
80. <version>${spring-cloud.version}</version>
81. <type>pom</type>
82. <scope>import</scope>
83. </dependency>
84. <dependency>
85. <groupId>org.mybatis.spring.boot</groupId>
86. <artifactId>mybatis-spring-boot-starter</artifactId>
87. <version>${mybatis.version}</version>
88. </dependency>
89. <dependency>
90. <groupId>io.jsonwebtoken</groupId>
91. <artifactId>jjwt</artifactId>
92. <version>${jwt.version}</version>
93. </dependency>
94. </dependencies>
95. </dependencyManagement>
97. </project></span>
根底配置:groupId、artifactId、version(2.0 版本)
1. <span style="font-size: 16px;"><groupId>com.honghu.cloud</groupId>
2. <artifactId>commonservice</artifactId>
3. <version>2.0</version>
4. <packaging>pom</packaging></span>
子项目模块:
1. <span style="font-size: 16px;"><modules>
2. <module>commonservice-eureka</module>
3. <module>commonservice-config</module>
4. <module>commonservice-gateway</module>
5. <module>commonservice-oauth</module>
6. <module>commonservice-monitor</module>
7. <module>commonservice-turbine</module>
8. <module>commonservice-user</module>
9. <module>commonservice-admin</module>
10. <module>commonservice-log</module>
11. <module>commonservice-file</module>
12. <module>commonservice-notification</module>
13. <module>commonservice-sequence</module>
14. </modules></span>
commonservice-eureka(服务注册核心)
commonservice-config(服务配置核心)
commonservice-gateway(服务网关)
commonservice-monitor(服务监控)
commonservice-turbine(集群监控)
commonservice-notification(零碎告诉)
commonservice-oauth(服务权限)
commonservice-sequence(主动生成分布式 ID)
commonservice-file(文件服务)
commonservice-log(日志服务)
commonservice-admin(通用治理集成平台)
Spring Boot2.0 版本
1. <span style="font-size: 16px;"><parent>
2. <groupId>org.springframework.boot</groupId>
3. <artifactId>spring-boot-starter-parent</artifactId>
4. <version>2.0.4.RELEASE</version>
5. </parent></span>
通用版本号配置
1. <span style="font-size: 16px;"><properties>
2. <spring-cloud.version>Finchley.RELEASE</spring-cloud.version>
3. <mybatis.version>1.3.2</mybatis.version>
4. <jwt.version>0.9.0</jwt.version>
5. <fastjson.version>1.2.47</fastjson.version>
6. <commons-collections>4.1</commons-collections>
7. <monitor.version>2.0.2</monitor.version>
8. <swagger.version>2.8.0</swagger.version>
9. <aliyun-sdk-oss.version>2.8.2</aliyun-sdk-oss.version>
10. <aliyun-sdk-core.version>3.2.8</aliyun-sdk-core.version>
11. <aliyun-sdk-dysmsapi.version>1.1.0</aliyun-sdk-dysmsapi.version>
12. <elasticsearch.version>6.2.3</elasticsearch.version>
13. <security-oauth2.version>2.3.3.RELEASE</security-oauth2.version>
14. <docker.image.prefix>springboot</docker.image.prefix>
15. </properties></span>
正文完