1

I have following interfaces:

@NoRepositoryBean
public interface UserRepository<T extends User> extends JpaRepository<T, String>, JpaSpecificationExecutor<T>

@ProfileRed
public interface RedUserRepository extends UserRepository<RedUser>

@ProfileGreen
public interface GreenUserRepository extends UserRepository<GreenUser> 

And I want to inject UserRepository depending on active profile. But there's one problem when I inject UserRepository like

@Autowire UserRepository userRepository

some methods inherited from JpaRepository and CrudRepository expect object but not User. If I move these methods from JpaRepository and CrudRepository to my UserRepository all seems to be working well

Dmitry Shipaev
  • 81
  • 1
  • 1
  • 5

0 Answers0