1. 程式人生 > >Spring 註解為空解決方案

Spring 註解為空解決方案

1、@Service用於標註業務層元件
2、@Controller用於標註控制層元件(如struts中的action)
3、@Repository用於標註資料訪問元件,即DAO元件.
4、@Component泛指元件,當元件不好歸類的時候,我們可以使用這個註解進行標註。 包括工具類。

注意:在@Component標註監聽類後,不用在web.xml配置相關監聽了