diff --git a/.inscode b/.inscode index db510a8f5d2c43fd4b7a33edfa9170d4604454ce..a63317e2ada0b3eba0637c36d6a25a122eb9d122 100644 --- a/.inscode +++ b/.inscode @@ -1,4 +1,4 @@ -run = "mvn -Dmaven.test.skip=true spring-boot:run" +run = "mvn clean package -Dmaven.test.skip=true -P dev;cd target;java -jar springboot-template*.jar" language = "java" [debugger] diff --git a/pom.xml b/pom.xml index cdc994ddb78e265032159c9dc70dd5c6a4b6dbf0..05f63446ecb1635bed248e08528dc08b90e7a468 100644 --- a/pom.xml +++ b/pom.xml @@ -17,7 +17,7 @@ jar - 17 + 1.8 @@ -41,32 +41,32 @@ - + - + - + --> - + @@ -107,36 +107,35 @@ - + dev true - dev + dev - + test false - test + test - + prod false - prod + prod - diff --git a/src/main/java/com/template/TemplateApplication.java b/src/main/java/com/template/TemplateApplication.java index f433dd3a3ca34852090051e32f7267bdf6ba3dad..1a15476a2612068481466acc4a67e58bf61bb46b 100644 --- a/src/main/java/com/template/TemplateApplication.java +++ b/src/main/java/com/template/TemplateApplication.java @@ -3,7 +3,7 @@ package com.template; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -@SpringBootApplication(scanBasePackages = {"com.skygod.base", "com.skygod.usermanagement"}) +@SpringBootApplication(scanBasePackages = {"com.template"}) public class TemplateApplication { public static void main(String[] args) { diff --git a/src/main/java/com/template/config/MybatisPlusConfig b/src/main/java/com/template/config/MybatisPlusConfig index f1cb72db179ca0084d5678526c190b29f373b14f..c6d5fa21c2b1f1bc8d459906105eca4c29276c2b 100644 --- a/src/main/java/com/template/config/MybatisPlusConfig +++ b/src/main/java/com/template/config/MybatisPlusConfig @@ -7,8 +7,9 @@ import org.mybatis.spring.annotation.MapperScan; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -@Configuration -@MapperScan(basePackages = "com.template.*.mapper") +// 注意启动该配置项需要在pom中取消mybatisplus、druid等依赖的注释,同时必须配置数据源否则启动报错 +// @Configuration +// @MapperScan(basePackages = "com.template.*.mapper") public class MybatisPlusConfig { @Bean diff --git a/src/main/java/com/template/controller/TestController.java b/src/main/java/com/template/controller/TestController.java index aa3b5396326b543bfd671055d85b25fa65eb5c6f..c866b5060505be3a3bb9623d02463ac8dff966e0 100644 --- a/src/main/java/com/template/controller/TestController.java +++ b/src/main/java/com/template/controller/TestController.java @@ -1,5 +1,23 @@ package com.template.controller; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@Api(tags = "测试服务") +@RestController +@RequestMapping("/test") public class TestController { + @Value("${env}") + private String env; + @GetMapping("/getEnv") + @ApiOperation("查询当前环境") + public String getEnv(){ + return env; + } } diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index fa4130dd57b8c3463eac6c43899588222e9f6d49..52acfa3c1df82d4eed4b3a69a47d4da42068d323 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -1,3 +1 @@ -server: - servlet: - context-path: /dev \ No newline at end of file +env: "开发环境" \ No newline at end of file diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml index 925dad702b94de1c2b3059fe53417a7dd5b53e9c..d4fd9be994cc4d9d26c1afceb88ac4557c49d8b6 100644 --- a/src/main/resources/application-prod.yml +++ b/src/main/resources/application-prod.yml @@ -1,3 +1 @@ -server: - servlet: - context-path: /prod \ No newline at end of file +env: "生产环境" \ No newline at end of file diff --git a/src/main/resources/application-test.yml b/src/main/resources/application-test.yml index 815ce766afbe122cb3c8ae5d78b6b50602015b6d..253805dbf537ddff9be7a6ae0152a0de18679df2 100644 --- a/src/main/resources/application-test.yml +++ b/src/main/resources/application-test.yml @@ -1,3 +1 @@ -server: - servlet: - context-path: /test \ No newline at end of file +env: "验收环境" \ No newline at end of file diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 54b155fffd11fee84bd0ce1152f747d9ebe47f51..02c4101762642663213b781615fccd300c3639f1 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1,2 +1,13 @@ server: - port: 8081 \ No newline at end of file + port: 8081 + servlet: + context-path: /springboot-template + +spring: + # swagger配置 + mvc: + pathmatch: + matching-strategy: ant_path_matcher + + profiles: + active: @spring.profiles.active@ \ No newline at end of file diff --git a/target/classes/application-dev.yml b/target/classes/application-dev.yml new file mode 100644 index 0000000000000000000000000000000000000000..52acfa3c1df82d4eed4b3a69a47d4da42068d323 --- /dev/null +++ b/target/classes/application-dev.yml @@ -0,0 +1 @@ +env: "开发环境" \ No newline at end of file diff --git a/target/classes/application-prod.yml b/target/classes/application-prod.yml new file mode 100644 index 0000000000000000000000000000000000000000..d4fd9be994cc4d9d26c1afceb88ac4557c49d8b6 --- /dev/null +++ b/target/classes/application-prod.yml @@ -0,0 +1 @@ +env: "生产环境" \ No newline at end of file diff --git a/target/classes/application-test.yml b/target/classes/application-test.yml new file mode 100644 index 0000000000000000000000000000000000000000..253805dbf537ddff9be7a6ae0152a0de18679df2 --- /dev/null +++ b/target/classes/application-test.yml @@ -0,0 +1 @@ +env: "验收环境" \ No newline at end of file diff --git a/target/classes/application.yml b/target/classes/application.yml new file mode 100644 index 0000000000000000000000000000000000000000..d1155a2a804faf62e69a3371193783c9d1814c68 --- /dev/null +++ b/target/classes/application.yml @@ -0,0 +1,13 @@ +server: + port: 8081 + servlet: + context-path: /springboot-template + +spring: + # swagger配置 + mvc: + pathmatch: + matching-strategy: ant_path_matcher + + profiles: + active: dev \ No newline at end of file diff --git a/target/classes/com/template/TemplateApplication.class b/target/classes/com/template/TemplateApplication.class new file mode 100644 index 0000000000000000000000000000000000000000..f55e5bb68e5bef0a8f1acadca40eedb413cf99f7 Binary files /dev/null and b/target/classes/com/template/TemplateApplication.class differ diff --git a/target/classes/com/template/config/SwaggerConfig.class b/target/classes/com/template/config/SwaggerConfig.class new file mode 100644 index 0000000000000000000000000000000000000000..fe0b8625ce71089eb788fb36e76b586b10bb336f Binary files /dev/null and b/target/classes/com/template/config/SwaggerConfig.class differ diff --git a/target/classes/com/template/config/WebMvcConfiguration.class b/target/classes/com/template/config/WebMvcConfiguration.class new file mode 100644 index 0000000000000000000000000000000000000000..99e3e320072bb95673721befb0b6bef7d8b94b0d Binary files /dev/null and b/target/classes/com/template/config/WebMvcConfiguration.class differ diff --git a/target/classes/com/template/controller/TestController.class b/target/classes/com/template/controller/TestController.class new file mode 100644 index 0000000000000000000000000000000000000000..00c34196812c00e1a3a16969c3586557e5c35481 Binary files /dev/null and b/target/classes/com/template/controller/TestController.class differ diff --git a/target/maven-archiver/pom.properties b/target/maven-archiver/pom.properties new file mode 100644 index 0000000000000000000000000000000000000000..31ef176054cf0e78713062e68d502e2493d9876d --- /dev/null +++ b/target/maven-archiver/pom.properties @@ -0,0 +1,3 @@ +artifactId=springboot-template +groupId=com.test +version=0.0.1-SNAPSHOT diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst new file mode 100644 index 0000000000000000000000000000000000000000..f366dde9e88b489a1ef932d11759dec20056793d --- /dev/null +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -0,0 +1,4 @@ +com/template/config/SwaggerConfig.class +com/template/controller/TestController.class +com/template/TemplateApplication.class +com/template/config/WebMvcConfiguration.class diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst new file mode 100644 index 0000000000000000000000000000000000000000..5055220321e951cde544396e06c741a9c37b42a2 --- /dev/null +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -0,0 +1,4 @@ +/root/springboot-template/src/main/java/com/template/config/WebMvcConfiguration.java +/root/springboot-template/src/main/java/com/template/config/SwaggerConfig.java +/root/springboot-template/src/main/java/com/template/controller/TestController.java +/root/springboot-template/src/main/java/com/template/TemplateApplication.java diff --git a/target/springboot-template-0.0.1-SNAPSHOT.jar b/target/springboot-template-0.0.1-SNAPSHOT.jar new file mode 100644 index 0000000000000000000000000000000000000000..a68a43f5107ab37cfb00312ccac200446bdb1d7e Binary files /dev/null and b/target/springboot-template-0.0.1-SNAPSHOT.jar differ diff --git a/target/springboot-template-0.0.1-SNAPSHOT.jar.original b/target/springboot-template-0.0.1-SNAPSHOT.jar.original new file mode 100644 index 0000000000000000000000000000000000000000..58ece7718f6c3921ca2d1008919a4d083fa382cb Binary files /dev/null and b/target/springboot-template-0.0.1-SNAPSHOT.jar.original differ