Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Configuration
- @ImportResource("classpath:/com/acme/properties-config.xml")
- public class AppConfig {
- private @Value("${jdbc.url}") String url;
- private @Value("${jdbc.username}") String username;
- private @Value("${jdbc.password}") String password;
- public @Bean DataSource dataSource() {
- return new DriverManagerDataSource(url, username, password);
- }
- }
- /*---------------------------------*/
- properties-config.xml
- <beans>
- <context:property-placeholder location="classpath:/com/acme/jdbc.properties"/>
- </beans>
- /*---------------------------------*/
- jdbc.properties
- jdbc.url=jdbc:hsqldb:hsql://localhost/xdb
- jdbc.username=sa
- jdbc.password=
Add Comment
Please, Sign In to add comment