Spring with 14.1.4 Could not Autowire Test

Someting happened when I recently upgraded from 14 to 14.1.4.

I have a base unit test class that is defined like this:

    classes = {
public abstract class AbstractWorkerTest extends Test { ... }

If I have any @Inject statements in the above class they look fine in intellij. However, any tests that inherit from this class that have @Inject statements are highlighted as errors with the message "Could not autowire". The tests run fine, I just would like to get rid of this error WITHOUT disabling the inspection.

Also note that this error does not show up in any of my production classes in this package, only the tests classes that inherit from AbstractWorkerTest.

Any ideas? This was not previously the case.


Comment actions Permalink

Alright, I figured this out. Apparently previous version of IntelliJ inherited the @ComponentScan annotation differently. In my test package I have a TestAppConfiguration class that inherits from an AppConfiguration class. The AppConfiguration class includes the @ComponentScan annotation. This worked before. With the latest version I have to make sure that TestAppConfiguration (that extends AppConfiguration) also has the @ComponentScan annotation.

Any ideas what might have changed?

Comment actions Permalink

Could you please file a bug and attach the sample code if possible? Thanks.



Please sign in to leave a comment.