Advertisement
Guest User

Untitled

a guest
Jan 16th, 2017
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. @SpringBootApplication
  2. @EnableConfigurationProperties
  3. @ComponentScan
  4.  
  5. public class MyApplication {
  6. @Bean(name="dmDs")
  7. @ConfigurationProperties("spring.datasource")
  8. public DataSource dmDataSource(){
  9. return DataSourceBuilder.create().build();
  10. }
  11. @Bean
  12. public String aBean(){
  13. DataSource ds = dmDataSource(); // creates a datasource with URL, username and password empty.
  14. return new String("");
  15. }
  16.  
  17. spring:
  18. profiles: test
  19. datasource:
  20. url: jdbc:oracle:thin:SOME_URL
  21. driver-class-name: oracle.jdbc.OracleDriver
  22. password: test
  23. username: test
  24.  
  25. [main] o.s.c.e.PropertySourcesPropertyResolver : Found key 'spring.datasource.url' in [applicationConfig: [classpath:/application.yml]] with type [String]
  26. [main] o.s.c.e.PropertySourcesPropertyResolver : Found key 'spring.datasource.driver-class-name' in [applicationConfig: [classpath:/application.yml]] with type [String]
  27. [main] o.s.c.e.PropertySourcesPropertyResolver : Found key 'spring.datasource.password' in [applicationConfig: [classpath:/application.yml]] with type [String]
  28. [main] o.s.c.e.PropertySourcesPropertyResolver : Found key 'spring.datasource.username' in [applicationConfig: [classpath:/application.yml]] with type [String]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement