I'm trying to create a custom property placeholder.
At my Spring Configuration Class I have this:
@Configuration
@Import(ConfigurationClass2.class)
public class ConfigurationClass1 {
@Bean
@Lazy(false)
public static PropertySourcesPlaceholderConfigurer settings() throws IOException {
// custom load of my properties file
// legacy configuration, comes from a SVN repository
// I need to download it and then do some logic and finally
// load it.
}
}
At another configuration class I want to access some properties using the Environment
, like this:
@Configuration
@EnableScheduling
public class ConfigurationClass2 {
@Autowired
private Environment env;
@Bean
public DataSource dataSource() {
String jdbcUrl = env.getProperty('jdbc.url');
.... // jdbcUrl is null!!!!
}
@Scheduled(cron = "${cronExpression}")
public void worker() {
}
}
I don't want to use @Value
or @PropertySource
.
I need to load this properties manually and access this values programmatically!
How can I solve this?