简体   繁体   中英

Edit Jar file with xml or properties file in Java

I have an own .jar file with some configuration about OAuth2 and Spring security Server. Now I want to edit file .xml in it to suitable with my project (like url, value, name). So do we have any way to do it.

Thanks.

An option is to externalize your properties into a property file, web container (tomcat, jboss)enviroment variables or SO enviroment variables.

Then you need to tell Spring where your properties are located

@Configuration
@PropertySource("file:${app.home}/app.properties")
public class AppConfig {
    @Autowired
    Environment env;
}

Here there are some tutorials

https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html

http://www.mkyong.com/spring/spring-propertysources-example/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM