简体   繁体   English

为什么服务不接受服务实施?

[英]why Service is not taking by the Service implementation?

this is my service:这是我的服务:





this is my service implementation:这是我的服务实现:

@Service
public class CategoryServiceImpl implements CategoryService {

    @Autowired()
    private CategoryRepo categoryRepo;
    

}

and this is the output result:这是 output 结果:

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.

For defining your CategoryRepo as a bean it should extend CrudRepository为了将您的CategoryRepo定义为一个 bean,它应该扩展CrudRepository

The repo which you've defined in your code must extend JpaRepsitory.您在代码中定义的存储库必须扩展 JpaRepsitory。 Inorder, to qualify it as a been and for better understanding of your please share your Repository file once here.为了使它成为过去并更好地理解您,请在此处共享您的存储库文件一次。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM