//如果这个启动类所在的包路径隐藏的很深,则需要指定扫描包.否则默认扫描启动类所在的子包路径下 @SpringBootApplication(scanBasePackages="com.joyce.users") public class MyApplication{ public static void main(String[] args){ SpringApplication.run(MyApplication.class,args); } }
spring boot 启动类一定要放置到包的根目录下,也就是和所有包含java文件的包在同一级目录.将会将同一目录下的包扫描成bean. 如果不放置在根目录下,将会提示 no mybatis mapper was found 2017-11-28 10:30:12.048 WARN 3852 --- [ main] o.m.s.mapper.ClassPathMapperScanner : No MyBatis mapper was found in '[com
Description: 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. Action: Consider defining a bean of type 'com.gcy.springsecuritydemo.dao.