How do I configure a PropertyPlaceholderConfigurer using the new javaConfig annotations.
For example i have simple config class:
How do i specify where to load the properties file from? I don't want to have a create a seperate xml file just to load the properties, i wanted to have a complete annotation based solution.Code:@Configuration public class FxFeed { private @Value("${jdbcProperties.url}") String jdbcUrl; private @Value("${jdbcProperties.username}") String username; private @Value("${jdbcProperties.password}") String password; @Bean public DataSource dataSource() throws SQLException { OracleDataSource ds = new OracleDataSource(); ds.setURL(jdbcUrl); ds.setUser(username); ds.setPassword(password); return ds; } }
Previous using xml config i would have:
Code:<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="locations"> <list> <value>classpath:instance.properties</value> </list> </property> </bean>


Reply With Quote
