啓動類加註解@MapperScan spring boot mybatis 啓動錯誤

Description:spring

Field userDao in com.gcy.springsecuritydemo.service.user.UserService required a bean of type 'com.gcy.springsecuritydemo.dao.user.UserDao' that could not be found.mybatis


Action:app

Consider defining a bean of type 'com.gcy.springsecuritydemo.dao.user.UserDao' in your configuration.socket

Disconnected from the target VM, address: '127.0.0.1:61935', transport: 'socket'ide

Process finished with exit code 1ui

 

解決辦法:啓動類加註解@MapperScanspa

@SpringBootApplication @MapperScan("com.gcy.springsecuritydemo.dao")//mybatis掃描
public class SpringsecuritydemoApplication { public static void main(String[] args) { SpringApplication.run(SpringsecuritydemoApplication.class, args); } }
相關文章
相關標籤/搜索