Quantcast
Channel: JetBrains Developer Community : Thread List - IntelliJ IDEA Users
Viewing all articles
Browse latest Browse all 5661

Possible Bug in Spring Facets

$
0
0

If I expose a concrete class as a Bean in a @Configuration class IntelliJ till think the class is setup as a @Component and if it has a constructor that takes an argument I will get a "Class does not contain matching constructor for autowiring." error.

 

Try this:

 

 

public class MyBean {

     private MyOtherBean otherBean;


     public MyBean( MyOtherBean otherBean ) {

         this.otherBean = otherBean;


         ...

}


@Configuration

public class MyConfiguration {

 

    @Bean

    public MyOtherBean myOtherBean() {

        return new MyOtherBean();

    }

 

    @Bean

    public MyBean myBean() {

        return new MyBean( myOtherBean() );

    }

}

 

In this example MyBean.class shows up as red. If I add an @Inject annotation to the MyBean constructor the error goes away but I should not have to because I am manually wiring the bean in the configuration class. Any ideas?

 

Thanks!

 

R.


Viewing all articles
Browse latest Browse all 5661

Trending Articles