Answer the question
In order to leave comments, you need to log in
What about findOne when migrating code from Spring Boot 1.5.X to 2.X?
After switching from Spring Boot 1.5.X to version 2.X , errors rained down:
"Inferred type 'S' for type parameter 'S' is not within its bound; should extend 'ua.com.philmo.backend.entity.ProjectEntity".
public interface GeneralDao<T> {
T getById(Long id); // получение объекта по id
}
public interface ProjectDao extends GeneralDao<ProjectEntity> {
}
@Repository
public interface ProjectRepository extends JpaRepository<ProjectEntity, Long> {
}
@Service
public class ProjectService implements ProjectDao {
private final ProjectRepository projectRepository;
@Autowired
public ProjectService(ProjectRepository projectRepository) {
this.projectRepository = projectRepository;
}
@Override
public ProjectEntity getById(Long id) {
return projectRepository.findOne(id); // <-- ПРОБЛЕМНОЕ МЕСТО !!!!
}
}
♿️How to treat?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question