Spring:@Component与@Bean
我知道@Component在Spring 2.5中引入了注释,以便通过使用类路径扫描来消除xml bean的定义。
@Component
@Bean是在3.0版本中引入的,可以用来@Configuration完全摆脱xml文件并使用java配置。
@Bean
@Configuration
是否可以重复使用@Component注释而不是引入@Bean注释?我的理解是,最终目标是在两种情况下都创建bean。
元芳怎么了
不负相思意
相关分类