您好,登錄后才能下訂單哦!
開始...
1、在上一章的初識springboot博文基礎上,新增三個配置文件:
(1).application-dev.yml
server:
port: 7001
(2).application-test.yml
server:
port: 7002
(3).application-prod.yml
server:
port: 7003
2、修改pom的打包方式
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork>
<mainClass>com.kyy.boot.SpringbootApp</mainClass>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<!--<appendAssemblyId>false</appendAssemblyId>-->
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>com.kyy.boot.SpringbootApp</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
3、打包
mvn -Dmaven.test.skip=true assembly:assembly
4、運行
java -jar kjxb-springboot-1.0-SNAPSHOT.jar -Dspring.profiles.active=prod
...結束
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。