Spring Boot开发中 遇到的问题描述:
Description:
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.
- Bean method 'dataSource' not loaded because @ConditionalOnProperty (spring.datasource.jndi-name) did not find property 'jndi-name'
- Bean method 'dataSource' not loaded because @ConditionalOnBean (types: org.springframework.boot.jta.XADataSourceWrapper; SearchStrategy: all) did not find any beans of type org.springframework.boot.jta.XADataSourceWrapper
Action:
Consider revisiting the conditions above or defining a bean of type 'javax.sql.DataSource' in your configuration.
Process finished with exit code 1
解决办法:
@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)
public class PagingSortingApplication {
更换为:
@SpringBootApplication
public class PagingSortingApplication {
也就是去掉:(exclude = DataSourceAutoConfiguration.class) 这段代码即可!
备注: 每个人遇到对的问题不一样,我的遇到了这个问题,去掉这哥注解,问题就得到了,解决,希望能帮到正在看我博客的你!
在SpringBoot项目中,遇到因未正确配置DataSource而引发的HibernateJpaAutoConfiguration错误。解决办法是移除@SpringBootApplication注解中的exclude参数,具体地,删除(exclude=DataSourceAutoConfiguration.class)这一段代码。
3911

被折叠的 条评论
为什么被折叠?



