java 为什么服务没有被服务实现占用?

gr8qqesn  于 2023-01-07  发布在  Java
关注(0)|答案(1)|浏览(135)

这是我的服务:
这是我的服务实现:

@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.
70gysomp

70gysomp1#

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

相关问题