Not able to set spring.datasource.type

前端 未结 2 648
忘掉有多难
忘掉有多难 2020-12-18 10:24

I\'m trying to setup c3p0 on my spring boot server. This is my config right now

spring.datasource.url=jdbc:mysql://url/db
spring.datasource.username=username         


        
2条回答
  •  难免孤独
    2020-12-18 10:51

    spring.datasource.type has been introduced in the 1.3 line so you need Spring Boot 1.3.0.M5 to use that property (content assistance in your IDE should have give you the proper hint).

    On 1.2.x you need to create the DataSource bean yourself to force the type, something like

    @Bean
    @ConfigurationProperties("spring.datasource")
    public DataSource dataSource() {
       return DataSourceBuilder.create().type(ComboPooledDataSource.class)
                .build();
    }
    

提交回复
热议问题