beans.factory.BeanNotOfRequiredTypeException: Bean named 'usersService' is expe"/>
org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'usersService' is expe
这种错误,第一次找的时候找了1个小时没找到,后来抱着侥幸心理去修改
public class Demo {@Resource(name="usersService")private UsersServiceImpl us;@Test public void fun(){us.transform(2,3,100);}}
原本代码是这样的,一切都没问题,只要不让spring去管理事务就没问题,可是当spring去管理的时候就出现了这种错误,错误信息是你说的什么什么包。。。。而实际上应该用什么什么包。。。,遇到这个错误只需要将你的private UsersServiceImpl us这个实现类改成他的接口,即可 private UsersService us;就行了。
真心难受,找了这么久。。。希望能帮到大家。、
public class Demo {@Resource(name="usersService")private UsersService us;@Test public void fun(){us.transform(2,3,100);}}
成功了。
更多推荐
org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named
发布评论