net.optionfactory.spring.context.propertysources.ApplicationPropertiesConfig Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of context Show documentation
Show all versions of context Show documentation
optionfactory-spring context core
package net.optionfactory.spring.context.propertysources;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
/**
* Read application properties from the following locations:
*
*
* - {@code project.properties} from classpath, where properties filtered by maven should be placed;
* - {@code ${project.name}.properties} from classpath, containing unfiltered properties;
* - {@code git.properties} from classpath, containing git information generated by pl.project13.maven:git-commit-id-plugin;
* - {@code ~/.${project.name}.properties}, for local development environment overrides (use this feature responsibly);
* - {@code /opt/${project.name}/conf/project.properties}, for testing/production environment overrides, such as jdbc properties.
*
*
* Moreover, enables property placeholders (e.g. {@code @Value("${...}")})
* replacement using the above properties sources.
*
* Import this configuration class in every Spring context that requires such
* application properties.
*/
@Configuration
@ApplicationProperties
public class ApplicationPropertiesConfig {
@Bean
public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
return new PropertySourcesPlaceholderConfigurer();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy