Spring Boot jdbc datasource autoconfiguration fails on standalone tomcat

前端 未结 5 1395
别跟我提以往
别跟我提以往 2020-12-19 02:00

While trying to deploy and start a spring boot application on a standalone tomcat (7) instance, we ran into an issue were the autoconfigured spring datasource bean isn\'t fo

相关标签:
5条回答
  • 2020-12-19 02:13
    @EnableAutoConfiguration(exclude = { DataSourceAutoConfiguration.class,
            HibernateJpaAutoConfiguration.class,
            DataSourceTransactionManagerAutoConfiguration.class })
    

    Worked for me for version 1.3.3

    0 讨论(0)
  • 2020-12-19 02:15

    For me it was throwing the exception in JdbcTemplateAutoConfiguration. I added exclude JdbcTemplateAutoConfiguration in the Application.java. Hope it helps.

    @SpringBootApplication(exclude = { DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class, JdbcTemplateAutoConfiguration.class })
    
    0 讨论(0)
  • 2020-12-19 02:18

    This is most likely an issue with the 0.5.0.M6 version and the Tomcat version you are using. It does work with Spring Boot 0.5.0.M7 and Tomcat 7.0.47.

    0 讨论(0)
  • 2020-12-19 02:22

    I was facing the same issue earlier and same was resolved by adding

    @PropertySource("classpath:application.properties")
    

    in Application.java Hope this helps

    0 讨论(0)
  • 2020-12-19 02:25

    Hi make sure you are not missing the JPA library.

    spring-boot-starter-data-jpa

    0 讨论(0)
提交回复
热议问题