-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Labels
status: waiting-for-feedbackWe need additional information before we can continueWe need additional information before we can continuestatus: waiting-for-triageAn issue we've not yet triagedAn issue we've not yet triaged
Description
Summary
When defining a custom base repository interface plus implementation, Spring Data JPA attempts to derive a query from a non-derived method name and fails with:
No property 'getObj' found for type 'User'
Environment
- Spring Boot: 4.0.0
- Java: 25
- OS: macOS
Code Snippet
@SpringBootApplication
@EnableJpaRepositories(
basePackages = "com.example.demo.dao",
repositoryFactoryBeanClass = CustomBaseRepositoryFactoryBean.class
)
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}
@NoRepositoryBean
public interface BaseDao<T, ID extends Serializable>
extends JpaRepository<T, ID>, JpaSpecificationExecutor<T> {
T getObj(ID id);
}
public class BaseDaoImpl<T, ID extends Serializable>
extends SimpleJpaRepository<T, ID>
implements BaseDao<T, ID> {
private final EntityManager entityManager;
public BaseDaoImpl(JpaEntityInformation<T, ?> entityInformation,
EntityManager entityManager) {
super(entityInformation, entityManager);
this.entityManager = entityManager;
}
@Override
public T getObj(ID id) {
return findById(id).orElse(null);
}
}User repository:
public interface UserDao extends BaseDao<User, Long> {}Observed Behavior
Application fails to start with:
org.springframework.beans.factory.UnsatisfiedDependencyException: ...
No property 'getObj' found for type 'User'
Metadata
Metadata
Assignees
Labels
status: waiting-for-feedbackWe need additional information before we can continueWe need additional information before we can continuestatus: waiting-for-triageAn issue we've not yet triagedAn issue we've not yet triaged