intellij incorrectly saying no beans of type found for autowired repository

前端 未结 30 2913
北恋
北恋 2020-11-30 18:33

I have created a simple unit test but IntelliJ is incorrectly highlighting it red. marking it as an error

No beans?

30条回答
  •  自闭症患者
    2020-11-30 19:13

    Surprisingly, A Feign oriented project that successfully ran with Eclipse could not run in InteliJ. When started the application, InteliJ complained about the Feign client I tried to inject to the serviceImpl layer saying: field personRestClient (my Feign client) in ... required a bean of type ... that could not be found. Consider defining a bean of type '....' in your configuration.

    I wasted a long time trying to understand what is wrong. I found a solution (for InteliJ) which I do not completely understand:

    1. Alt Shift F10 (or run menu)
    2. Select 'Edit configuration'
    3. In configuration window, Check the checkbox 'include dependencies with "Provided" scope'
    4. Run your application

    Or choose Eclipse :)

提交回复
热议问题