1.Field userservice in test_gradle_speed.demo.controller.UserController required a bean of type ‘test_gradle_speed.demo.service.impl.UserServiceImpl’ that could not be found.
The injection point has the following annotations:
- @org.springframework.beans.factory.annotation.Autowired(required=true)
Action:
Consider defining a bean of type ‘test_gradle_speed.demo.service.impl.UserServiceImpl’ in your configuration.
原因:service层实现类没有加service备注
解决办法:
service层的实现类impl要加service注解 否则扫描不到
springboot部署项目时每层注解都要仔细
- No property password found for type String! Traversed path: User.username.
User findByUsernameAndPassword(String username,String password);
原因:repository层接口的的自定义方法没有按jpa规范写函数名称
还有一种可能是对应实体类没有该属性 获取不到
解决办法:原方法名为findByUsernamePassword(String username,string password);
按照规范应该username和password中加入and
改为:findByUsernameAndPassword后成功
jpa规范