@Repository注解的作用及含义

xiaoxiao2025-08-14  26

@Repository(value="userDao")

该注解是告诉Spring,让Spring创建一个名字叫“userDao”的UserDaoImpl实例。

当Service需要使用Spring创建的名字叫“userDao”的UserDaoImpl实例时,就可以使用@Resource(name = "userDao")注解告诉Spring,Spring把创建好的userDao注入给Service即可。

   原文章地址:点击打开

转载请注明原文地址: https://www.6miu.com/read-5034857.html

最新回复(0)