常見注解總結
定義配置:
@Comfiguration
@ComponentScan
定義元件:
@Component
@Autowired
@Autowired(required = false)
自動裝配歧義性:
@Primary
@Qualifier
@Resource
分層架構中定義元件:
@Controller
@Service
@Repository
Spring測試環境:
@RunWith
@ContextConfiguration
使用xml啟動元件掃描:
<context:component-scan base-package="……"/>