Closed lixx174 closed 11 months ago
If you would like us to spend some time helping you to diagnose the problem, please spend some time describing it and, ideally, providing a minimal yet complete sample that reproduces the problem. You can share it with us by pushing it to a separate repository on GitHub or by zipping it up and attaching it to this issue.
@mp911de I'm sorry that didn't describe it clearly.
this is the step to reproduce at spring boot 3.1.5:
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
the core code :
@Component
@RequiredArgsConstructor
public class OuterRepository {
// Autowired by constructor with lombok
private final InnerJpaRepository repo;
@Repository
public interface InnerJpaRepository extends JpaRepository<Object, Integer> {
}
}
In this case, when I start the application, the InnerJpaRepository
can't be Autowired and will get an error.
I konw that if I don't define InnerJpaRepository
as an inner class, it's all ok.
Thanks for the detail. By default, nested repository definitions are ignored. Please add @EnableJpaRepositories(considerNestedRepositories = true)
to your configuration to enable scanning for nested repository interfaces.
Thanks a lot
When I defined an inner interface and extends JpaRepositroy ,there is no proxy object in spring.
So I got an error that: Parameter 0 of constructor in com.security.infra.repository.DefaultOauth2ClientRepository required a bean of type 'com.security.infra.repository.DefaultOauth2ClientRepository$Oauth2ClientJpaRepository' that could not be found.
here is the source code: