关于报错Consider defining a bean of type 的解决
运行SpringBoot的时候报如下错Consider defining a bean of type ‘com.google.code.kaptcha.Producer’ in your configuration.
我们来看@SpringBootApplication,点过去。可以看到有个@ComponentScan,ComponentScan做的事情就是告诉Spring从哪里找到bean
那可以直接在@SpringBootApplication加上
@SpringBootApplication @ComponentScan(basePackages ={value = {"com.google.code", "aaa", "bbb" }) public class OfficialSystemApplication { public static void main(String[] args) { SpringApplication.run(xxxApplication.class,args); } }
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/202538.html原文链接:https://javaforall.net
