Advertisement
Guest User

Untitled

a guest
Sep 29th, 2017
630
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.23 KB | None | 0 0
  1. Parameter 0 of constructor in org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration required a bean of type 'javax.sql.DataSource' that could not be found.
  2. - Bean method 'dataSource' not loaded because @ConditionalOnProperty (spring.datasource.jndi-name) did not find property 'jndi-name'
  3. - Bean method 'dataSource' not loaded because @ConditionalOnBean (types: org.springframework.boot.jta.XADataSourceWrapper; SearchStrategy: all) did not find any beans
  4.  
  5. spring.datasource.url=jdbc:postgresql://localhost:5432/postgres
  6. spring.datasource.username=postgres
  7. spring.datasource.password=root
  8.  
  9. <properties>
  10. <hibernate.version>5.2.6.Final</hibernate.version>
  11. <spring.data.version>1.10.6.RELEASE</spring.data.version>
  12. </properties>
  13.  
  14. <parent>
  15. <groupId>org.springframework.boot</groupId>
  16. <artifactId>spring-boot-starter-parent</artifactId>
  17. <version>1.4.3.RELEASE</version>
  18. </parent>
  19.  
  20. <dependencies>
  21. <dependency>
  22. <groupId>org.springframework.boot</groupId>
  23. <artifactId>spring-boot-autoconfigure</artifactId>
  24. </dependency>
  25.  
  26. <dependency>
  27. <groupId>org.springframework.boot</groupId>
  28. <artifactId>spring-boot-starter-web</artifactId>
  29. </dependency>
  30.  
  31. <dependency>
  32. <groupId>org.springframework</groupId>
  33. <artifactId>spring-context</artifactId>
  34. <version>${spring.version}</version>
  35. </dependency>
  36. <dependency>
  37. <groupId>org.springframework</groupId>
  38. <artifactId>spring-tx</artifactId>
  39. <version>${spring.version}</version>
  40. </dependency>
  41. <dependency>
  42. <groupId>org.springframework</groupId>
  43. <artifactId>spring-orm</artifactId>
  44. <version>${spring.version}</version>
  45. </dependency>
  46. <dependency>
  47. <groupId>org.springframework.data</groupId>
  48. <artifactId>spring-data-jpa</artifactId>
  49. <version>${spring.data.version}</version>
  50. </dependency>
  51.  
  52. <dependency>
  53. <groupId>org.hibernate</groupId>
  54. <artifactId>hibernate-core</artifactId>
  55. <version>${hibernate.version}</version>
  56. </dependency>
  57.  
  58. <dependency>
  59. <groupId>org.projectlombok</groupId>
  60. <artifactId>lombok</artifactId>
  61. <version>1.16.12</version>
  62. </dependency>
  63.  
  64. <dependency>
  65. <groupId>org.postgresql</groupId>
  66. <artifactId>postgresql</artifactId>
  67. <version>9.4.1212</version>
  68. </dependency>
  69. </dependencies>
  70.  
  71. =========================
  72. AUTO-CONFIGURATION REPORT
  73. =========================
  74.  
  75.  
  76. Positive matches:
  77. -----------------
  78.  
  79. AopAutoConfiguration matched:
  80. - @ConditionalOnClass found required classes 'org.springframework.context.annotation.EnableAspectJAutoProxy', 'org.aspectj.lang.annotation.Aspect', 'org.aspectj.lang.reflect.Advice' (OnClassCondition)
  81. - @ConditionalOnProperty (spring.aop.auto=true) matched (OnPropertyCondition)
  82.  
  83. AopAutoConfiguration.JdkDynamicAutoProxyConfiguration matched:
  84. - @ConditionalOnProperty (spring.aop.proxy-target-class=false) matched (OnPropertyCondition)
  85.  
  86. DataSourceAutoConfiguration matched:
  87. - @ConditionalOnClass found required classes 'javax.sql.DataSource', 'org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType' (OnClassCondition)
  88.  
  89. DataSourceAutoConfiguration#dataSourceInitializer matched:
  90. - @ConditionalOnMissingBean (types: org.springframework.boot.autoconfigure.jdbc.DataSourceInitializer; SearchStrategy: all) did not find any beans (OnBeanCondition)
  91.  
  92. DataSourceTransactionManagerAutoConfiguration matched:
  93. - @ConditionalOnClass found required classes 'org.springframework.jdbc.core.JdbcTemplate', 'org.springframework.transaction.PlatformTransactionManager' (OnClassCondition)
  94.  
  95. DataSourceTransactionManagerAutoConfiguration.TransactionManagementConfiguration matched:
  96. - @ConditionalOnMissingBean (types: org.springframework.transaction.annotation.AbstractTransactionManagementConfiguration; SearchStrategy: all) did not find any beans (OnBeanCondition)
  97. ...
  98. DataSourceAutoConfiguration.EmbeddedDatabaseConfiguration:
  99. Did not match:
  100. - EmbeddedDataSource did not find embedded database (DataSourceAutoConfiguration.EmbeddedDatabaseCondition)
  101.  
  102. DataSourceAutoConfiguration.PooledDataSourceConfiguration:
  103. Did not match:
  104. - AnyNestedCondition 0 matched 2 did not; NestedCondition on DataSourceAutoConfiguration.PooledDataSourceCondition.PooledDataSourceAvailable PooledDataSource did not find supported DataSource; NestedCondition on DataSourceAutoConfiguration.PooledDataSourceCondition.ExplicitType @ConditionalOnProperty (spring.datasource.type) did not find property 'type' (DataSourceAutoConfiguration.PooledDataSourceCondition)
  105.  
  106. DataSourceAutoConfiguration.TomcatDataSourceJmxConfiguration:
  107. Did not match:
  108. - @ConditionalOnClass did not find required class 'org.apache.tomcat.jdbc.pool.DataSourceProxy' (OnClassCondition)
  109.  
  110. DataSourcePoolMetadataProvidersConfiguration.CommonsDbcp2PoolDataSourceMetadataProviderConfiguration:
  111. Did not match:
  112. - @ConditionalOnClass did not find required class 'org.apache.commons.dbcp2.BasicDataSource' (OnClassCondition)
  113.  
  114. DataSourcePoolMetadataProvidersConfiguration.CommonsDbcpPoolDataSourceMetadataProviderConfiguration:
  115. Did not match:
  116. - @ConditionalOnClass did not find required class 'org.apache.commons.dbcp.BasicDataSource' (OnClassCondition)
  117.  
  118. DataSourcePoolMetadataProvidersConfiguration.HikariPoolDataSourceMetadataProviderConfiguration:
  119. Did not match:
  120. - @ConditionalOnClass did not find required class 'com.zaxxer.hikari.HikariDataSource' (OnClassCondition)
  121.  
  122. DataSourcePoolMetadataProvidersConfiguration.TomcatDataSourcePoolMetadataProviderConfiguration:
  123. Did not match:
  124. - @ConditionalOnClass did not find required class 'org.apache.tomcat.jdbc.pool.DataSource' (OnClassCondition)
  125.  
  126. DataSourceTransactionManagerAutoConfiguration.DataSourceTransactionManagerConfiguration:
  127. Did not match:
  128. - @ConditionalOnSingleCandidate (types: javax.sql.DataSource; SearchStrategy: all) did not find any beans (OnBeanCondition)
  129.  
  130. @Configuration
  131. public class DBConfig{
  132.  
  133. @Bean
  134. public DataSource dataSource(){
  135. DriverManagerDataSource dataSource = new DriverManagerDataSource();
  136. dataSource.setDriverClassName("oracle.jdbc.driver.OracleDriver");
  137. dataSource.setUrl("your url");
  138. dataSource.setUsername( "username" );
  139. dataSource.setPassword( "password" );
  140. return dataSource;
  141. }
  142.  
  143. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement