overriding application.property file after command of dspring.config.loc

Viewed 75

I have application.property file inside resource folder with some properties in my project. I am trying to override that through command line dspring.config.locationt=//external file location but it's not overriding - why?

Here I am using the values of property file in my java code

@Configuration
@ConfigurationProperties(prefix = "app")
@Component
public class ApplicationProperties {

    @Value("${twilio.accont_sid}")
    private String twilioAccountSID;  

    @Value("${twilio.auth_token}")
   private String twilioAuthToken;

    @Value("${twilio.from.mobile}")
    private String twilioFromMobile; 

    so on............
} 

I want property file should override, after providing external property file location configuration

1 Answers

You can set this variable in your IDE or add to your command when running jar.file

-Dspring.config.location=file://external_conf.properties
Related