mirror of
https://gitee.com/ChinaLym/shoulder-platform.git
synced 2025-12-30 02:52:27 +00:00
feat: add archetype
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
<module>shoulder-platform-starter-trace</module>
|
||||
|
||||
<module>shoulder-sms-aliyun-spring-boot-starter</module>
|
||||
<module>shoulder-platform-archetype</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
# shoulder-platform-archetype
|
||||
|
||||
基于 `shoulder-platform` 的多模块的 `maven` 骨架工程,适合基于 spring cloud 的微服务模式的微服务工程。
|
||||
|
||||
## 诞生背景
|
||||
|
||||
项目中大都是分模块开发,一个模块一个工程,通过一个外层工程管理所有模块,充分利用maven的`聚合`、`继承`的特性来减少项目管理的成本。
|
||||
|
||||
> 聚合是为了管理多模块build,继承是方便依赖管理
|
||||
|
||||
目标是选择 `shoulder-platform-archetype` 便自动创建一个父模块,以及多个子模块,父模块既是聚合也可提供依赖继承。
|
||||
|
||||
|
||||
## 保姆级使用介绍
|
||||
|
||||
下面以 IDEA 为例,介绍如何通过 `shoulder-platform-archetype` 快速创建一个引入了`shoulder`的 spring boot web 工程
|
||||
|
||||
### 添加 shoulder 的 archetype
|
||||
|
||||
第一次使用时需要添加,以后都不用这一步咯,`version` 不同,创建的也可能不同哦
|
||||
|
||||
```
|
||||
groupId cn.itlym.platform
|
||||
artifactId shoulder-platform-archetype
|
||||
version 1.0-SNAPSHOT
|
||||
```
|
||||
|
||||

|
||||
|
||||
|
||||
### 基于 shoulder 提供的模板创建 maven 工程
|
||||
|
||||
#### 选择shoulder
|
||||

|
||||
|
||||
#### 输入 gourpId、artifactId
|
||||

|
||||
|
||||
#### 输入覆盖模板的值
|
||||

|
||||
确保 `rootArtifactId` 和 `appId` 相同
|
||||
|
||||
#### 完成创建
|
||||

|
||||
|
||||
#### 等待创建完毕
|
||||

|
||||
- 如果不设置缓存,这一步因访问maven官网,可能会比较慢,解决方式参考 [IDEA 创建maven工程 create from archetype 很慢](https://blog.csdn.net/qq_35425070/article/details/108958087)
|
||||
- 创建完毕后,我们需要 reimport maven 依赖,这里我们直接点击自动更新
|
||||
|
||||
#### 启动运行
|
||||

|
||||
|
||||
可以访问 DemoController [http://localhost:8080/demo/test](http://localhost:8080/demo/test) 查看一下
|
||||
|
||||
|
||||
---
|
||||
|
||||
## 模板属性表
|
||||
|属性 key | 说明 | 默认值 |
|
||||
|----|----|----|
|
||||
| appId | 应用/服务标识 | 使用 `${rootArtifactId}` 值 |
|
||||
| package | 包路径 | `${groupId}.${appId}` |
|
||||
| contextPath | 上下文路径 | `${appId}` |
|
||||
| StartClassName | 启动类名 | ShoulderApplication |
|
||||
| author | 作者名 | `${user.name}` |
|
||||
72
shoulder-platform-common/shoulder-platform-archetype/pom.xml
Normal file
72
shoulder-platform-common/shoulder-platform-archetype/pom.xml
Normal file
@@ -0,0 +1,72 @@
|
||||
<?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>cn.itlym.platform</groupId>
|
||||
<artifactId>shoulder-platform-archetype</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<packaging>maven-archetype</packaging>
|
||||
|
||||
<name>shoulder-platform-archetype</name>
|
||||
<description>shoulder platform 的多模块工程模板</description>
|
||||
|
||||
<url>https://github.com/ChinaLym/Shoulder-Platform</url>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<extensions>
|
||||
<extension>
|
||||
<groupId>org.apache.maven.archetype</groupId>
|
||||
<artifactId>archetype-packaging</artifactId>
|
||||
<version>3.2.0</version>
|
||||
</extension>
|
||||
</extensions>
|
||||
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-archetype-plugin</artifactId>
|
||||
<version>3.2.0</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
|
||||
|
||||
<developers>
|
||||
<developer>
|
||||
<name>lym</name>
|
||||
<email>cn_lym@foxmail.com</email>
|
||||
</developer>
|
||||
</developers>
|
||||
|
||||
<licenses>
|
||||
<license>
|
||||
<name>Apache 2</name>
|
||||
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
|
||||
<distribution>repo</distribution>
|
||||
<comments>A business-friendly OSS license</comments>
|
||||
</license>
|
||||
</licenses>
|
||||
|
||||
<scm>
|
||||
<connection>scm:git@github.com:ChinaLym/shoulder-framework.git</connection>
|
||||
<developerConnection>scm:git@github.com:ChinaLym/shoulder-framework.git</developerConnection>
|
||||
<url>git@github.com:ChinaLym/shoulder-framework.git</url>
|
||||
</scm>
|
||||
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>oss</id>
|
||||
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>
|
||||
</repository>
|
||||
<snapshotRepository>
|
||||
<id>oss</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,153 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<archetype-descriptor
|
||||
xsi:schemaLocation="https://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.1.0 http://maven.apache.org/xsd/archetype-descriptor-1.1.0.xsd"
|
||||
name="${rootArtifactId}"
|
||||
xmlns="https://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.1.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
|
||||
<!-- ================= 模板属性 ================= -->
|
||||
<requiredProperties>
|
||||
|
||||
<!-- 应用标识,一般与 ${artifactId} 相同 -->
|
||||
<requiredProperty key="appId">
|
||||
<defaultValue>${rootArtifactId}</defaultValue>
|
||||
</requiredProperty>
|
||||
|
||||
<!-- 包路径 -->
|
||||
<requiredProperty key="package">
|
||||
<defaultValue>${groupId}.${appId}</defaultValue>
|
||||
</requiredProperty>
|
||||
|
||||
<!-- 上下文路径,一般与 appId 相同 -->
|
||||
<requiredProperty key="contextPath">
|
||||
<defaultValue>${appId}</defaultValue>
|
||||
</requiredProperty>
|
||||
|
||||
<!-- 启动类名 -->
|
||||
<requiredProperty key="StartClassName">
|
||||
<defaultValue>ShoulderApplication</defaultValue>
|
||||
</requiredProperty>
|
||||
|
||||
<!-- 类的作者 -->
|
||||
<requiredProperty key="author">
|
||||
<defaultValue>${user.name}</defaultValue>
|
||||
</requiredProperty>
|
||||
|
||||
</requiredProperties>
|
||||
|
||||
<!-- ================= 外层模块文件 ================= -->
|
||||
<fileSets>
|
||||
<fileSet filtered="true" encoding="UTF-8">
|
||||
<directory></directory>
|
||||
<includes>
|
||||
<include>*.md</include>
|
||||
</includes>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
|
||||
<!-- ================= 模块结构 ================= -->
|
||||
<modules>
|
||||
<module id="${rootArtifactId}-api" dir="__rootArtifactId__-api" name="${rootArtifactId}-api">
|
||||
<fileSets>
|
||||
<fileSet filtered="true" packaged="true" encoding="UTF-8">
|
||||
<directory>src/main/java</directory>
|
||||
</fileSet>
|
||||
|
||||
<fileSet encoding="UTF-8">
|
||||
<directory>src/main/resources</directory>
|
||||
<includes>
|
||||
<include>**/*</include>
|
||||
</includes>
|
||||
</fileSet>
|
||||
|
||||
<fileSet filtered="true" encoding="UTF-8">
|
||||
<directory>src/test/java</directory>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
</module>
|
||||
|
||||
<module id="${rootArtifactId}-common" dir="__rootArtifactId__-common" name="${rootArtifactId}-common">
|
||||
<fileSets>
|
||||
<fileSet filtered="true" packaged="true" encoding="UTF-8">
|
||||
<directory>src/main/java</directory>
|
||||
</fileSet>
|
||||
|
||||
<fileSet encoding="UTF-8">
|
||||
<directory>src/main/resources</directory>
|
||||
<includes>
|
||||
<include>**/*</include>
|
||||
</includes>
|
||||
</fileSet>
|
||||
|
||||
<fileSet filtered="true" encoding="UTF-8">
|
||||
<directory>src/test/java</directory>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
</module>
|
||||
|
||||
<module id="${rootArtifactId}-core" dir="__rootArtifactId__-core" name="${rootArtifactId}-core">
|
||||
<fileSets>
|
||||
<fileSet filtered="true" packaged="true" encoding="UTF-8">
|
||||
<directory>src/main/java</directory>
|
||||
</fileSet>
|
||||
|
||||
<fileSet encoding="UTF-8">
|
||||
<directory>src/main/resources</directory>
|
||||
<includes>
|
||||
<include>**/*</include>
|
||||
</includes>
|
||||
</fileSet>
|
||||
|
||||
<fileSet filtered="true" encoding="UTF-8">
|
||||
<directory>src/test/java</directory>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
</module>
|
||||
|
||||
<module id="${rootArtifactId}-modules" dir="__rootArtifactId__-modules" name="${rootArtifactId}-modules">
|
||||
|
||||
<modules>
|
||||
<module id="${rootArtifactId}-xxx" dir="__rootArtifactId__-xxx" name="${rootArtifactId}-xxx">
|
||||
<fileSets>
|
||||
<fileSet filtered="true" packaged="true" encoding="UTF-8">
|
||||
<directory>src/main/java</directory>
|
||||
</fileSet>
|
||||
|
||||
<fileSet encoding="UTF-8">
|
||||
<directory>src/main/resources</directory>
|
||||
<includes>
|
||||
<include>**/*</include>
|
||||
</includes>
|
||||
</fileSet>
|
||||
|
||||
<fileSet filtered="true" encoding="UTF-8">
|
||||
<directory>src/test/java</directory>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
</module>
|
||||
|
||||
</modules>
|
||||
</module>
|
||||
|
||||
<module id="${rootArtifactId}-start" dir="__rootArtifactId__-start" name="${rootArtifactId}-start">
|
||||
<fileSets>
|
||||
<fileSet filtered="true" packaged="true" encoding="UTF-8">
|
||||
<directory>src/main/java</directory>
|
||||
</fileSet>
|
||||
|
||||
<fileSet encoding="UTF-8">
|
||||
<directory>src/main/resources</directory>
|
||||
<includes>
|
||||
<include>**/*</include>
|
||||
</includes>
|
||||
</fileSet>
|
||||
|
||||
<fileSet filtered="true" encoding="UTF-8">
|
||||
<directory>src/test/java</directory>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
|
||||
</module>
|
||||
</modules>
|
||||
|
||||
</archetype-descriptor>
|
||||
@@ -0,0 +1,2 @@
|
||||
# ${rootArtifactId}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
<?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">
|
||||
<parent>
|
||||
<groupId>${groupId}</groupId>
|
||||
<artifactId>${rootArtifactId}</artifactId>
|
||||
<version>${version}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>${artifactId}</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.ws.rs</groupId>
|
||||
<artifactId>javax.ws.rs-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.validation</groupId>
|
||||
<artifactId>validation-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.itlym</groupId>
|
||||
<artifactId>shoulder-core</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,20 @@
|
||||
<?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">
|
||||
<parent>
|
||||
<artifactId>${rootArtifactId}</artifactId>
|
||||
<groupId>${groupId}</groupId>
|
||||
<version>${version}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>${artifactId}</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>${groupId}</groupId>
|
||||
<artifactId>${rootArtifactId}-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* 这里实现 api / ui 接口
|
||||
*/
|
||||
package ${package}.common.controller;
|
||||
@@ -0,0 +1,25 @@
|
||||
<?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">
|
||||
<parent>
|
||||
<groupId>${groupId}</groupId>
|
||||
<artifactId>${rootArtifactId}</artifactId>
|
||||
<version>${version}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>${artifactId}</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>${groupId}</groupId>
|
||||
<artifactId>${rootArtifactId}-common</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.itlym.platform</groupId>
|
||||
<artifactId>shoulder-platform-starter-micro</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,13 @@
|
||||
<?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">
|
||||
<parent>
|
||||
<groupId>${groupId}</groupId>
|
||||
<artifactId>${rootArtifactId}-modules</artifactId>
|
||||
<version>${version}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>${rootArtifactId}-xxx</artifactId>
|
||||
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,21 @@
|
||||
<?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">
|
||||
<parent>
|
||||
<groupId>${groupId}</groupId>
|
||||
<artifactId>${rootArtifactId}</artifactId>
|
||||
<version>${version}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>${artifactId}</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>${groupId}</groupId>
|
||||
<artifactId>${rootArtifactId}-core</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,74 @@
|
||||
<?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">
|
||||
<parent>
|
||||
<groupId>${groupId}</groupId>
|
||||
<artifactId>${rootArtifactId}</artifactId>
|
||||
<version>${version}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>${artifactId}</artifactId>
|
||||
<name>${artifactId}</name>
|
||||
<description>${artifactId}</description>
|
||||
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>${groupId}</groupId>
|
||||
<artifactId>${rootArtifactId}-xxx</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<profiles>
|
||||
<!-- 开发环境 -->
|
||||
<profile>
|
||||
<id>dev</id>
|
||||
<properties>
|
||||
<profile.active>dev</profile.active>
|
||||
</properties>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
</profile>
|
||||
|
||||
<!-- 测试环境-->
|
||||
<profile>
|
||||
<id>test</id>
|
||||
<properties>
|
||||
<profile.active>test</profile.active>
|
||||
</properties>
|
||||
</profile>
|
||||
|
||||
<!-- 生产环境-->
|
||||
<profile>
|
||||
<id>prod</id>
|
||||
<properties>
|
||||
<profile.active>prod</profile.active>
|
||||
</properties>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<build>
|
||||
<!-- maven 默认使用 artifactId+version拼接 -->
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
|
||||
<!-- 动态打包环境配置源文件 -->
|
||||
<filters>
|
||||
<filter>../../dynamicConfig/config-${profile.active}.properties</filter>
|
||||
</filters>
|
||||
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<includes>
|
||||
<include>**/*</include>
|
||||
</includes>
|
||||
<!-- 是否替换资源中的属性,properties.yml、banner 中需要获取应用版本号、名称、描述 -->
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,40 @@
|
||||
#set( $symbol_pound = '#' )
|
||||
#set( $symbol_dollar = '$' )
|
||||
#set( $symbol_escape = '\' )
|
||||
package ${package}.common.controller;
|
||||
|
||||
import lombok.extern.shoulder.SLog;
|
||||
import org.shoulder.core.log.Logger;
|
||||
import org.shoulder.core.log.LoggerFactory;
|
||||
import org.shoulder.web.annotation.SkipResponseWrap;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author ${author}
|
||||
*/
|
||||
//@SLog // 与 @Slf4j 类似,在希望打日志的类上添加 @SLog 注解,编译时将生成类似下面定义 logger 的代码
|
||||
@SkipResponseWrap // 该类所有方法的返回值将不被包装
|
||||
@RestController
|
||||
@RequestMapping("demo")
|
||||
public class DemoController {
|
||||
|
||||
/**
|
||||
* 定义 shoulder 的 logger, 使用注解 {@link SLog} 时则可不写这行代码
|
||||
*/
|
||||
private static final Logger log = LoggerFactory.getLogger(DemoController.class);
|
||||
|
||||
|
||||
/**
|
||||
* 访问 http://localhost:8080/demo/test 测试
|
||||
*/
|
||||
@GetMapping("test")
|
||||
public String test() {
|
||||
return "this is a demo controller";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
${AnsiColor.CYAN} ____ _ _ _ ${AnsiColor.BRIGHT_YELLOW} ____ _ ____ _ ${AnsiColor.CYAN} __ __ __
|
||||
${AnsiColor.CYAN}/ ___|| |__ ___ _ _| | __| | ___ _ __ ${AnsiColor.BRIGHT_YELLOW} / ___| _ _ ___| |_ ___ _ __ ___ / ___|___ _ __ | |_ ___ _ __ ${AnsiColor.CYAN} \ \ \ \ \ \
|
||||
${AnsiColor.CYAN}\___ \| '_ \ / _ \| | | | |/ _` |/ _ \ '__|${AnsiColor.BRIGHT_YELLOW} \___ \| | | / __| __/ _ \ '_ ` _ \ _____| | / _ \ '_ \| __/ _ \ '__|${AnsiColor.CYAN} \ \ \ \ \ \
|
||||
${AnsiColor.CYAN} ___) | | | | (_) | |_| | | (_| | __/ | ${AnsiColor.BRIGHT_YELLOW} ___) | |_| \__ \ || __/ | | | | |_____| |__| __/ | | | || __/ | ${AnsiColor.CYAN} / / / / / /
|
||||
${AnsiColor.CYAN}|____/|_| |_|\___/ \__,_|_|\__,_|\___|_| ${AnsiColor.BRIGHT_YELLOW} |____/ \__, |___/\__\___|_| |_| |_| \____\___|_| |_|\__\___|_| ${AnsiColor.CYAN} / / / / / /
|
||||
${AnsiColor.CYAN}===================================================${AnsiColor.BRIGHT_YELLOW}|___/${AnsiColor.CYAN}==========================================================/_/==/_/===/_/
|
||||
|
||||
${AnsiColor.BLUE} :: Spring Boot :: ${AnsiColor.CYAN}${spring-boot.formatted-version}
|
||||
${AnsiColor.BLUE} :: Shoulder-Framework :: ${AnsiColor.CYAN}(v@shoulder.version@)
|
||||
${AnsiColor.BRIGHT_GREEN} :: @project.artifactId@ :: ${AnsiColor.GREEN}(v@project.version@)${AnsiColor.CYAN} @project.description@
|
||||
${AnsiColor.DEFAULT}
|
||||
@@ -0,0 +1,58 @@
|
||||
# 先从环境变量里取,若不存在,则以 maven 打包时的配置为准
|
||||
shoulder:
|
||||
nacos:
|
||||
ip: ${NACOS_IP:@nacos.ip@}
|
||||
port: ${NACOS_PORT:@nacos.port@}
|
||||
namespace: ${NACOS_ID:@nacos.namespace@}
|
||||
|
||||
# spring-boot-actuate 展示信息
|
||||
info:
|
||||
name: "@project.name@"
|
||||
description: "@project.description@"
|
||||
version: "@project.version@"
|
||||
spring-boot-version: ${spring-boot.version}
|
||||
spring-cloud-version: ${spring-cloud.version}
|
||||
shoulder-version: "@shoulder.version@"
|
||||
profile: "@profile.active@"
|
||||
|
||||
# ================================== 配置正文 ================================
|
||||
spring:
|
||||
#allow-bean-definition-overriding: true
|
||||
application:
|
||||
name: ${info.name}
|
||||
profiles:
|
||||
active: ${info.profile}
|
||||
cloud:
|
||||
nacos:
|
||||
config:
|
||||
server-addr: ${shoulder.nacos.ip}:${shoulder.nacos.port} # 改为自己的 nacos 地址命名空间
|
||||
file-extension: yml
|
||||
# namespace: ${shoulder.nacos.namespace} # 改为自己的 nacos 地址命名空间
|
||||
shared-configs:
|
||||
- dataId: common.yml
|
||||
refresh: true
|
||||
- dataId: ${spring.application.name}.yml
|
||||
refresh: true
|
||||
- dataId: redis.yml
|
||||
refresh: false
|
||||
- dataId: db.yml
|
||||
refresh: true
|
||||
- dataId: mq-rabbitmq.yml
|
||||
refresh: false
|
||||
enabled: true
|
||||
|
||||
discovery:
|
||||
server-addr: ${shoulder.nacos.ip}:${shoulder.nacos.port}
|
||||
namespace: ${shoulder.nacos.namespace}
|
||||
metadata:
|
||||
management.context-path: ${server.servlet.context-path:}${spring.mvc.servlet.path:}${management.endpoints.web.base-path:}
|
||||
|
||||
boot:
|
||||
admin:
|
||||
client:
|
||||
url: localhost:12365
|
||||
#username:
|
||||
#password:
|
||||
instance:
|
||||
prefer-ip: true
|
||||
service-url: localhost:8080
|
||||
@@ -0,0 +1,2 @@
|
||||
shoulder.test.hi=hi
|
||||
shoulder.test.hello=hello, {0}
|
||||
@@ -0,0 +1,3 @@
|
||||
shoulder.test.hi=\u55E8
|
||||
shoulder.test.hello=\u4F60\u597D,{0}
|
||||
shoulder.test.cnSpecial=\u53EA\u6709\u4E2D\u6587\u7684\u8D44\u6E90\u5305\u4E2D\u6709\u8FD9\u53E5\u8BDD
|
||||
@@ -0,0 +1,3 @@
|
||||
# \u7531\u4E8E\u5DE5\u7A0B\u4E2D\u53EF\u80FD\u6709\u591A\u4E2A\u6A21\u5757\uFF0Cshoulder \u5141\u8BB8\u591A\u8BED\u8A00\u6587\u4EF6\u5206\u6A21\u5757\u7EF4\u62A4
|
||||
module2.test=\u6A21\u57572\u591A\u8BED\u8A00
|
||||
module2.cnSpecial=\u6A21\u57572\u72EC\u6709
|
||||
@@ -0,0 +1,5 @@
|
||||
# 由于工程中可能有多个模块,shoulder 允许多语言文件分模块维护
|
||||
且多语言文件命名不限,也不像原生spring那样需要为每个翻译文件配置具体的文件名,shoulder 会自动解析
|
||||
|
||||
# shoulder 会自动识别多语言翻译文件,不会加载与多语言不相干的文件(如本文件)
|
||||
你可以在多语言资源文件下添加自己的说明文件,就像本文件这样,shoulder 会自动忽略
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
@@ -0,0 +1,47 @@
|
||||
<?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">
|
||||
<parent>
|
||||
<groupId>cn.itlym.platform</groupId>
|
||||
<artifactId>shoulder-platform-parent</artifactId>
|
||||
<version>1.0-SNAPSHOT</version><!-- shoulder-platform-version -->
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>${artifactId}</artifactId>
|
||||
|
||||
<groupId>${groupId}</groupId>
|
||||
<packaging>pom</packaging>
|
||||
<version>${version}</version><!-- ${rootArtifactId}.version -->
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>${groupId}</groupId>
|
||||
<artifactId>${rootArtifactId}-api</artifactId>
|
||||
<version>${version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>${groupId}</groupId>
|
||||
<artifactId>${rootArtifactId}-common</artifactId>
|
||||
<version>${version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>${groupId}</groupId>
|
||||
<artifactId>${rootArtifactId}-core</artifactId>
|
||||
<version>${version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>${groupId}</groupId>
|
||||
<artifactId>${rootArtifactId}-xxx</artifactId>
|
||||
<version>${version}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,11 @@
|
||||
#Thu Oct 08 16:43:25 CST 2020
|
||||
package=cn.itlym.test
|
||||
groupId=archetype.it
|
||||
artifactId=basic
|
||||
version=0.1-SNAPSHOT
|
||||
appId=basic
|
||||
StartClassName=ShoulderApplication
|
||||
contextPath=basic
|
||||
author=lym
|
||||
|
||||
gitignore=.gitignore
|
||||
Reference in New Issue
Block a user