jMarts
jMarts

Reputation: 1

Spring Boot : PropertySourcesPlaceholderConfigurer is not loading system properties

I have a Spring Boot application as follows:

@SpringBootApplication
@PropertySource(ignoreResourceNotFound=true,value={"classpath:application.properties","classpath:util-${spring.profiles.active}.properties"})
@ComponentScan("com.jmarts")
@EnableTransactionManagement
public class Application extends SpringBootServletInitializer {

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }

    @Override
    protected SpringApplicationBuilderconfigure(SpringApplicationBuilder application) {
        return application.sources(Application.class);
    } 
}

I assume spring boot will register a PropertySourcesPlaceholderConfigurer if none is configured.

Upvotes: 0

Views: 533

Answers (1)

Persia
Persia

Reputation: 895

spring boot officially supports profile-specific properties using the naming convention application-{profile}.properties.
so you can remove "classpath:util-${spring.profiles.active}.properties" and add application-local.properties, application-dev.properties and so on in the classpath.

Upvotes: 0

Related Questions