[Spring] Meta annotations and @Autowired.
I have several meta annotations like the following:
@ContextConfiguration(locations = {"classpath:/META-INF/spring/application.xml"})
@Transactional
@Retention(RUNTIME)
@Target(TYPE)
public @interface JpaRepositoryTest {}used in tests like this:
@JpaRepositoryTest
@RunWith(SpringJUnit4ClassRunner.class)
public class FooRepositoryTest {
@Autowired FooRepository repository;
@Test
public void test() { ... }}Now, the test runs fine, however IntellIJ marks @Autowired dependency as "Autowired members must be defined in a valid spring bean" (it disappears if I move @ContextConfiguration to FooRepositoryTest).
Is there some sort of configuration to make IntelliJ see the spring context from composite annotation or this feature is simply not supported?
Please sign in to leave a comment.
It should work in IntelliJ IDEA 15.x
Well, it does not... I guess it's a bug then.
Please report at http://youtrack.jetbrains.com/issues/IDEA .
Any updates about this problem? I'm facing a similar issue.
I have the following meta annotation:
The tests runs fine but the IDE doesn't recognize the @Autowired objects and I get the following message:
Is there any work in progress for this subject ? I'm still having the same problem in 2017.3 : tests run fine but intellij doesn't recognize the auto-wired beans.
Please create an issue on YouTrack attaching sample project example: http://youtrack.jetbrains.com/issues/IDEA .