BeanNotOfRequiredTypeException due to autowired fields

前端 未结 9 1261
长发绾君心
长发绾君心 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:03

    I found lots of questions similar to this one, when searching google for my problem. However, in my case I already used an interface. So I thought this might be helpful for others:

    This exception could also appear, if you have two beans with the same name!

    In my case I had additional bean configuration in my applicationContext.xml. The problem appeared after I merged two applications. The second one defined a @Resource and its member-variable name matched the bean name of the first application, mentioned above. Of course, the bean configuration of the first application didn't fit for the bean included via @Resource by the second application.

提交回复
热议问题