Add in the startup class: @SpringBootApplication(scanBasePackages={"com.example.chart2.controller", "com.example.chart2.service"}) contains the packages you need to scan