learn-katacoda
learn-katacoda copied to clipboard
Error in Spring Boot development on OpenShift
I am walking through ‘Spring Boot development on OpenShift’ at this site https://learn.openshift.com/developing-with-spring/
on ‘6. Run and Verify step where it is testing out the Fruit Repository. This is in Step 2 of 5 .
I am receiving these errors
ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- [ERROR] /root/projects/rhoar-getting-started/spring/spring-rhoar-intro/src/test/java/com/example/ApplicationTest.java:[36,33] cannot find symbol symbol: method findById(int) location: variable fruitRepository of type com.example.service.FruitRepository [ERROR] /root/projects/rhoar-getting-started/spring/spring-rhoar-intro/src/test/java/com/example/ApplicationTest.java:[41,38] cannot find symbol symbol: method findById(int) location: variable fruitRepository of type com.example.service.FruitRepository [ERROR] /root/projects/rhoar-getting-started/spring/spring-rhoar-intro/src/test/java/com/example/ApplicationTest.java:[48,35] cannot find symbol symbol: method findById(int) location: variable fruitRepository of type com.example.service.FruitRepository [ERROR] /root/projects/rhoar-getting-started/spring/spring-rhoar-intro/src/test/java/com/example/ApplicationTest.java:[54,39] cannot find symbol symbol: method findById(int) location: variable fruitRepository of type com.example.service.FruitRepository [ERROR] /root/projects/rhoar-getting-started/spring/spring-rhoar-intro/src/test/java/com/example/ApplicationTest.java:[57,35] cannot find symbol symbol: method findById(int) location: variable fruitRepository of type com.example.service.FruitRepository [ERROR] /root/projects/rhoar-getting-started/spring/spring-rhoar-intro/src/test/java/com/example/ApplicationTest.java:[62,33] cannot find symbol symbol: method findById(int)
--
Yes, I've got it also. It is caused because they use Spring Boot 1.5 and it doesn't have findById in Spring Data, only findOne (not Optional). If you rename method findById -> findOne and remove 'orElse' part it will work.
We have updated to newer Spring and verified all of the scenarios work as expected. Please re-test at your convenience.