org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'usersService'

编程入门 行业动态 更新时间:2024-10-21 14:39:08

org.springframework.<a href=https://www.elefans.com/category/jswz/34/1738852.html style=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 �

本文发布于:2024-03-02 09:04:27,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1707697.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:beans   factory   org   springframework   BeanNotOfRequiredTypeException

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!