Java error with "var" SpringBoot CrudRepository

Viewed 32

it's a simple question but I don't know what to do. I am working with JDK 8 and I can't use var now, so how should declare that list to avoid having that error?? Pleasee help, and thank you and bless you

enter image description here

PersonDao

1 Answers

The error in the console indicates an auto-wiring issue, your Dao class isn’t getting found by spring. Change the package of your dao to gm.dao. Your IDE should have a command that will change the package in the class file and also move the class file to the right directory for the new package.

Also make sure the controller has an import statement for the dao class. It’s not evident from the picture if that is present or not.

When you use the SpringBootApplication annotation, component scanning starts at the package where your SpringBootApplication is defined (here that package is gm), and works only on classes in directories under that.

Related