Spring註解@Component、@Repository、@Service、@Controller區別

Spring註解@Component、@Repository、@Service、@Controller區別:

•@Service用於標註業務層組件

•@Controller用於標註控制層組件(如struts中的action)

•@Repository用於標註數據訪問組件,即DAO組件

•@Component泛指組件,當組件不好歸類的時候,我們可以使用這個註解進行標註。

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