提交 56eff32a 编写于 作者: W weixin_43814374

Auto Commit

上级 ce2ccbc7
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" language = "java"
[debugger] [debugger]
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<packaging>jar</packaging> <packaging>jar</packaging>
<properties> <properties>
<java.version>17</java.version> <java.version>1.8</java.version>
</properties> </properties>
<dependencies> <dependencies>
...@@ -41,32 +41,32 @@ ...@@ -41,32 +41,32 @@
</dependency> </dependency>
<!--druid starter--> <!--druid starter-->
<dependency> <!-- <dependency>
<groupId>com.alibaba</groupId> <groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId> <artifactId>druid-spring-boot-starter</artifactId>
<version>1.1.10</version> <version>1.1.10</version>
</dependency> </dependency> -->
<!--mysql--> <!--mysql-->
<dependency> <!-- <dependency>
<groupId>mysql</groupId> <groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId> <artifactId>mysql-connector-java</artifactId>
<version>5.1.47</version> <version>5.1.47</version>
</dependency> </dependency> -->
<!--mybatis--> <!--mybatis-->
<!--<dependency> <!-- <dependency>
<groupId>org.mybatis.spring.boot</groupId> <groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId> <artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.1.0</version> <version>2.1.0</version>
</dependency>--> </dependency> -->
<!--mybatis-plus--> <!--mybatis-plus-->
<dependency> <!-- <dependency>
<groupId>com.baomidou</groupId> <groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId> <artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.4.0</version> <version>3.4.0</version>
</dependency> </dependency> -->
<!--swagger3--> <!--swagger3-->
<dependency> <dependency>
...@@ -107,36 +107,35 @@ ...@@ -107,36 +107,35 @@
</build> </build>
<profiles> <profiles>
<!--开发环境--> <!-- 开发环境 -->
<profile> <profile>
<id>dev</id> <id>dev</id>
<activation> <activation>
<activeByDefault>true</activeByDefault> <activeByDefault>true</activeByDefault>
</activation> </activation>
<properties> <properties>
<profileName>dev</profileName> <spring.profiles.active>dev</spring.profiles.active>
</properties> </properties>
</profile> </profile>
<!--测试环境--> <!-- 测试环境 -->
<profile> <profile>
<id>test</id> <id>test</id>
<activation> <activation>
<activeByDefault>false</activeByDefault> <activeByDefault>false</activeByDefault>
</activation> </activation>
<properties> <properties>
<profileName>test</profileName> <spring.profiles.active>test</spring.profiles.active>
</properties> </properties>
</profile> </profile>
<!--生产环境--> <!-- 生产环境 -->
<profile> <profile>
<id>prod</id> <id>prod</id>
<activation> <activation>
<activeByDefault>false</activeByDefault> <activeByDefault>false</activeByDefault>
</activation> </activation>
<properties> <properties>
<profileName>prod</profileName> <spring.profiles.active>prod</spring.profiles.active>
</properties> </properties>
</profile> </profile>
</profiles> </profiles>
</project> </project>
...@@ -3,7 +3,7 @@ package com.template; ...@@ -3,7 +3,7 @@ package com.template;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication(scanBasePackages = {"com.skygod.base", "com.skygod.usermanagement"}) @SpringBootApplication(scanBasePackages = {"com.template"})
public class TemplateApplication { public class TemplateApplication {
public static void main(String[] args) { public static void main(String[] args) {
......
...@@ -7,8 +7,9 @@ import org.mybatis.spring.annotation.MapperScan; ...@@ -7,8 +7,9 @@ import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
@Configuration // 注意启动该配置项需要在pom中取消mybatisplusdruid等依赖的注释,同时必须配置数据源否则启动报错
@MapperScan(basePackages = "com.template.*.mapper") // @Configuration
// @MapperScan(basePackages = "com.template.*.mapper")
public class MybatisPlusConfig { public class MybatisPlusConfig {
@Bean @Bean
......
package com.template.controller; 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 { public class TestController {
@Value("${env}")
private String env;
@GetMapping("/getEnv")
@ApiOperation("查询当前环境")
public String getEnv(){
return env;
}
} }
server: env: "开发环境"
servlet: \ No newline at end of file
context-path: /dev
\ No newline at end of file
server: env: "生产环境"
servlet: \ No newline at end of file
context-path: /prod
\ No newline at end of file
server: env: "验收环境"
servlet: \ No newline at end of file
context-path: /test
\ No newline at end of file
server: server:
port: 8081 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
env: "开发环境"
\ No newline at end of file
env: "生产环境"
\ No newline at end of file
env: "验收环境"
\ No newline at end of file
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
artifactId=springboot-template
groupId=com.test
version=0.0.1-SNAPSHOT
com/template/config/SwaggerConfig.class
com/template/controller/TestController.class
com/template/TemplateApplication.class
com/template/config/WebMvcConfiguration.class
/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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册