Advertisement
Guest User

Untitled

a guest
Jan 16th, 2017
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.25 KB | None | 0 0
  1. @SpringBootApplication
  2. @EnableConfigurationProperties
  3. @ComponentScan
  4.  
  5. public class MyApplication {
  6. @Bean(name="dmDs")
  7. @Primary
  8. @ConfigurationProperties("spring.datasource")
  9. public DataSource dmDataSource(){
  10. return DataSourceBuilder.create().build();
  11. }
  12. @Bean
  13. public String aBean(){
  14. DataSource ds = dmDataSource(); // creates a datasource with URL, username and password empty.
  15. return new String("");
  16. }
  17.  
  18. spring:
  19. autoconfigure:
  20. exclude:
  21. - org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfiguration
  22. - org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration
  23. - org.springframework.boot.autoconfigure.jms.JndiConnectionFactoryAutoConfiguration
  24. - org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
  25. profiles:
  26. active: test
  27. ---
  28.  
  29. spring:
  30. profiles: test
  31. datasource:
  32. url: jdbc:oracle:thin:SOME_URL
  33. driver-class-name: oracle.jdbc.OracleDriver
  34. password: test
  35. username: test
  36. datacollector:
  37. datasource:
  38. driver-class-name: oracle.jdbc.OracleDriver
  39. url: jdbc:oracle:thin:@SOME_URL
  40. username: user
  41. password: pass
  42.  
  43. [main] o.s.c.e.PropertySourcesPropertyResolver : Found key 'spring.datasource.url' in [applicationConfig: [classpath:/application.yml]] with type [String]
  44. [main] o.s.c.e.PropertySourcesPropertyResolver : Found key 'spring.datasource.driver-class-name' in [applicationConfig: [classpath:/application.yml]] with type [String]
  45. [main] o.s.c.e.PropertySourcesPropertyResolver : Found key 'spring.datasource.password' in [applicationConfig: [classpath:/application.yml]] with type [String]
  46. [main] o.s.c.e.PropertySourcesPropertyResolver : Found key 'spring.datasource.username' in [applicationConfig: [classpath:/application.yml]] with type [String]
  47. JdbcTemplateAutoConfiguration matched:
  48. - @ConditionalOnClass found required classes 'javax.sql.DataSource', 'org.springframework.jdbc.core.JdbcTemplate' (OnClassCondition)
  49. - @ConditionalOnSingleCandidate (types: javax.sql.DataSource; SearchStrategy: all) found a primary bean from beans 'cipDs', 'dmDs' (OnBeanCondition)
  50.  
  51. SpringApplication.run(new Object[]{DecisionManagementApplication.class,ApplicationConfig.class}, args);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement