Can't use findOne() in my code with JpaRepository

Try using the following 2 options based on the requirement :-

yourRespository.findById(id).get();// it will return an Optional instead of null

yourRespository.findById(id).orElse(null); // this will return null if you have proper null checks

There has been some changes with the recent versions of spring data jpa and they have removed the findOne() method which used work earlier. you can check the post here for reference - https://stackoverflow.com/a/44103020/2600196

Or revert back to old spring data jpa version