BeanNotOfRequiredTypeException due to autowired fields

前端 未结 9 1239
长发绾君心
长发绾君心 2020-12-02 12:07

I\'m still new to Spring MVC and while building my test project, I got this message from Tomcat logs:

SEVERE: Exception sending context initialized event to          


        
9条回答
  •  死守一世寂寞
    2020-12-02 13:01

    Somewhere in your code you must be autowiring AdminServiceImpl like this:

    @Autowired
    private AdminServiceImpl adminService;
    

    Either depend barely on interface:

    @Autowired
    private AdminService adminService;
    

    or enabled CGLIB proxies.

    Similar problems

    • Autowired spring bean is not a proxy
    • Fixing BeanNotOfRequiredTypeException on Spring proxy cast on a non-singleton bean?
    • Getting Spring Error "Bean named 'x' must be of type [y], but was actually of type [$Proxy]" in Jenkins
    • Original interface is lost in Spring AOP introduction

提交回复
热议问题