先转发点别人的再补充:(94条消息) SpringBoot教程(十一)——将Bean放入Spring容器中的五种方式_三尺微命 一介书生的博客-CSDN博客_springboot添加bean到容器中
1、@Bean是一个方法级别上的注解,主要用在@Configuration注解的类里,也可以用在@Component注解的类里。添加的bean的id为方法名
2、除了@Componet,还有 @Repository , @ Controller , @Service 等
先转发点别人的再补充:(94条消息) SpringBoot教程(十一)——将Bean放入Spring容器中的五种方式_三尺微命 一介书生的博客-CSDN博客_springboot添加bean到容器中
1、@Bean是一个方法级别上的注解,主要用在@Configuration注解的类里,也可以用在@Component注解的类里。添加的bean的id为方法名
2、除了@Componet,还有 @Repository , @ Controller , @Service 等