我有一个自己的.jar文件,里面有一些关于OAuth2和Spring security Server的配置。现在我想在其中编辑文件.xml以适合我的项目(如url、值、名称)。那么我们有没有办法做到这一点。
谢谢。
发布于 2015-12-08 21:25:34
一个选项是将你的属性外部化到一个属性文件,web容器(tomcat,jboss)环境变量或者其他环境变量中。
然后,您需要告诉Spring您的属性位于何处
@Configuration
@PropertySource("file:${app.home}/app.properties")
public class AppConfig {
@Autowired
Environment env;
}这里有一些教程
https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html
http://www.mkyong.com/spring/spring-propertysources-example/
https://stackoverflow.com/questions/34152534
复制相似问题