我知道@Component在Spring 2.5中引入了注释,以便通过使用类路径扫描来消除xml bean的定义.
@Component
@Bean是在3.0版本中引入的,可以用来@Configuration完全摆脱xml文件并使用java配置.
@Bean
@Configuration
是否可以重复使用@Component注释而不是引入@Bean注释?我的理解是,最终目标是在两种情况下都创建bean.
java spring annotations autowired
annotations ×1
autowired ×1
java ×1
spring ×1