作者:亚璨的秘密 | 来源:互联网 | 2023-08-17 10:22
Description:
Field userRepository in com.example.demo.controller.UserController required a bean of type 'com.example.demo.repository.UserRepository' that could not be found.
Action:
Consider defining a bean of type 'com.example.demo.repository.UserRepository' in your configuration.
1 2 3 4
| @Repository
public interface UserRepository extends JpaRepository {
} |
1 2 3 4 5 6 7 8 9 10 11
| @RestController
public class UserController {
@Autowired
private UserRepository userRepository;
@GetMapping("/simple/{id}")
public User findById(@PathVariable Long id) {
return this.userRepository.findOne(id);
}
} |
请问我这个问题怎么解决呀?非常谢谢!