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