In our code we have a number of Spring JPA repositories, one for each of our model classes. They are defined as (where <Name>
is the name of our modal class):
@Repository
public interface <Name>Repository implements JpaRepository<Name, Long> {
// …
}
We inject them in our beans using the @Inject
annotation from javax
:
@Inject
public void set<Name>Repository(<Name>Repository <name>Repo) {
this.<name>Repo = <name>Repo;
}
private <Name>Repository <name>Repo;
The issue is that IntelliJ underlines the <name>Repo
in the set<Name>Repository
function as an error with the text:
Could not autowire. There is more than one bean of 'Repository' type. Beans: Repo, Repo.
This is only a problem with the inspection. Compilation and running our app works fine, but in the effort of making the inspections in IJ usable this is a big problem. Anyone have suggestions on how to get IntelliJ to behave?
For reference, we are using Hibernate as our JPA provider, and the data source is set up in both the Database and Persistence tool windows.