Spring Boot auto configuration for datasource

后端 未结 2 1990
春和景丽
春和景丽 2020-12-09 15:13

I try to create Spring Boot app with Hibernate 5 and Postgres 9. Now I have next error:

Parameter 0 of constructor in org.springframework.boot.autoconfigure         


        
2条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-09 15:42

    well the above solution might worked but in my case with weblogic 11g above solution could not help me. so attaching this solution so anyone elsestruggling with this problem find it useful.

    solution:

    Adding DataSource bean configuration in component scan classpath will fix this for servlets 2.5 like weblogic 10.3.6(11g) like below

    @Configuration
    public class DBConfig{
    
           @Bean
           public DataSource dataSource(){
              DriverManagerDataSource dataSource = new DriverManagerDataSource();
              dataSource.setDriverClassName("oracle.jdbc.driver.OracleDriver");
              dataSource.setUrl("your url");
              dataSource.setUsername( "username" );
              dataSource.setPassword( "password" );
              return dataSource;
           }
    
    }
    

提交回复
热议问题