I am trying to build simple blog app with Spring boot.However, now I am facing an issue with "The method findOne(Long) is undefined for the type PersonRepository" when I try to use findOne for my service.java.Below are what I did
I tried to create objects in repository indicating findOne and save.However it didn't help
PersonRepository.java
package PersonRepository.javaio.javabrains.repository;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import io.javabrains.Entity.Person;
@Repository
public interface PersonRepository extends CrudRepository<Person,Long>{
public Person findByEmail(String email);
/*
* public Person findOne(Long id);
*
* public Iterable<Person> findAll();
*
* public Person save(Person person);
*/
PersonService.java
@Service
public class PersonService {
@Autowired
private PersonRepository personRepository;
public Object findAll(){
return personRepository.findAll();
}
public Person findById(Long id){
return personRepository.findOne(id);
}
I expected eliminating comment blocks would solve the issue.However, when I try to run the app ,it shows an error
Aucun commentaire:
Enregistrer un commentaire