springboot工程打包时将application.properties放在jar包外

1、pom文件配置


		
			
				org.apache.maven.plugins
				maven-resources-plugin
				2.5
				
					
						copy-resources
						package
						
							copy-resources
						
						
							UTF-8
							${project.released.directory}
							
								
									./src/main/resources
									
										application.properties
									
								
							
						
					
				
			
		

复制代码

2、Application.java添加注解

@PropertySource("file:application.properties")
复制代码

转载于:https://juejin.im/post/5cde25fee51d4569ab41db2e

你可能感兴趣的:(springboot工程打包时将application.properties放在jar包外)