JavaSpring常見註解總結

常見註解總結

定義配置:
@Comfiguration
@ComponentScan

定義組件:
@Component
@Autowired
@Autowired(required = false)

自動裝配歧義性:
@Primary
@Qualifier
@Resource

分層架構中定義組件:
@Controller
@Service
@Repository

Spring測試環境:
@RunWith
@ContextConfiguration

使用xml啓動組件掃描:
<context:component-scan base-package="……"/>

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章