springboot中同时引入jdbc和jpa报错问题解决(The bean 'userRepository', defined in null, could not be registered..)

1.在springboot中同时使用jdbcTemplate和Jpa的时候,项目启动报错,错误信息为:

(The bean 'userRepository', defined in null, could not be registered. A bean with that name has already been defined in null and overriding is disabled.)

2.截图如下:

springboot中同时引入jdbc和jpa报错问题解决(The bean 'userRepository', defined in null, could not be registered..)_第1张图片

 3.网上搜索多种办法未能解决,最后仔细阅读pom.xml,发现,jdbc的依赖引入错误,我引入的是

springboot中同时引入jdbc和jpa报错问题解决(The bean 'userRepository', defined in null, could not be registered..)_第2张图片

正确的依赖是:

springboot中同时引入jdbc和jpa报错问题解决(The bean 'userRepository', defined in null, could not be registered..)_第3张图片

更换后重新启动,恢复正常! 

你可能感兴趣的:(springboot中同时引入jdbc和jpa报错问题解决(The bean 'userRepository', defined in null, could not be registered..))