SpringMVC常用註解@Controller,@Service,@repository,@Component

@Repository(value="xxxDao")註解是告訴Spring,讓Spring創建一個名字叫「xxxDao」的xxxDaoImpl實例。 當Service需要使用Spring創建的名字叫「userDao」的UserDaoImpl實例時,就可以使用@Resource(name = "userDao")註解告訴Spring,Spring把創建好的userDao注入給Service即可。
相關文章
相關標籤/搜索