“Parameter 0 of method sqlSessionFactory in com.xxx.config.MyBatisConfig required a bean of type ‘javax.sql.DataSource’ that could not be found.” 这个错误通常出现在你的Spring应用程序中,当你在MyBatis配置中尝试使用Hikari数据源时。这个错误意味着Spring容器无法找到与MyBatis配置相关联的数据源。
***************************
APPLICATION FAILED TO START
***************************
Description:
Parameter 0 of method sqlSessionFactory in com.xxx.config.MyBatisConfig required a bean of type 'javax.sql.DataSource' that could not be found.
Action:
Consider revisiting the entries above or defining a bean of type 'javax.sql.DataSource' in your configuration.
Process finished with exit code 1
要解决这个问题,您可以按照以下方法进行排查和修复:
修复前:
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
修复后:
去掉exclude = { DataSourceAutoConfiguration.class }
@SpringBootApplication
版权声明:本文为博主作者:星际编程喵原创文章,版权归属原作者,如果侵权,请联系我们删除!
原文链接:https://blog.csdn.net/qq_29901385/article/details/133903290