开始...

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的打包方式


        
            
                org.springframework.boot
                spring-boot-maven-plugin
                
                    true
                    com.kyy.boot.SpringbootApp
                
                
                    
                        
                            repackage
                        
                    
                
            
            
                maven-assembly-plugin
                
                    
                    
                        jar-with-dependencies
                    
                    
                        
                            true
                            com.kyy.boot.SpringbootApp
                        
                    
                
                
                    
                        make-assembly
                        package
                        
                            single
                        
                    
                
            
        
    

3、打包

mvn -Dmaven.test.skip=true assembly:assembly

4、运行

java -jar kjxb-springboot-1.0-SNAPSHOT.jar -Dspring.profiles.active=prod

...结束