相关疑难解决方法(0)

Spring:@Component与@Bean

我知道@Component在Spring 2.5中引入了注释,以便通过使用类路径扫描来消除xml bean的定义.

@Bean是在3.0版本中引入的,可以用来@Configuration完全摆脱xml文件并使用java配置.

是否可以重复使用@Component注释而不是引入@Bean注释?我的理解是,最终目标是在两种情况下都创建bean.

java spring annotations autowired

387
推荐指数
14
解决办法
21万
查看次数

标签 统计

annotations ×1

autowired ×1

java ×1

spring ×1