Field studentRepository in com.example.demo.StudentController required a bean of type 'com.example.demo.StudentRepository' that could not be found.
Action:
Consider defining a bean of type 'com.example.demo.StudentRepository' in your configuration.
@RestController
public class StudentController {
@Autowired
private StudentRepository studentRepository;
@GetMapping(value = "/findAll")
public List<Student> studentList(){
return studentRepository.findAll();
}
}
StudentRepository 繼承 JpaRepository,應(yīng)該是個(gè)最簡(jiǎn)單的例子了
一共就一個(gè)包,SpringBootApplication和Controller都放在一個(gè)包下面,應(yīng)該不會(huì)出現(xiàn)網(wǎng)上的順序的問(wèn)題
添加回答
舉報(bào)
0/150
提交
取消