为什么服务没有被服务实现接受?



这是我的服务:



这是我的服务实现:

@Service
public class CategoryServiceImpl implements CategoryService {
@Autowired()
private CategoryRepo categoryRepo;

}

,输出结果如下:

Description:
Field categoryRepo in com.example.demo.services.impl.CategoryServiceImpl required a bean of type 'com.example.demo.repositories.CategoryRepo' 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 'com.example.demo.repositories.CategoryRepo' in your configuration.

要将CategoryRepo定义为bean,它应该扩展CrudRepository

您在代码中定义的repo必须扩展jparerepository。为了使其符合条件并更好地理解您的内容,请在这里分享您的存储库文件。

最新更新