为了账号安全,请及时绑定邮箱和手机立即绑定

来自另一个模块的 Spring Boot 自动装配

来自另一个模块的 Spring Boot 自动装配

慕码人2483693 2021-10-13 10:30:58
我正在尝试在我的项目中的 3 个模块之间建立连接。当我尝试使用 @Autowired 到达我的对象时出现错误。我会稍微解释一下我的场景。所有这些模块都在 pom.xml 内部连接。说说我的问题吧。C -> 路由.JAVA...@Autowiredpublic CommuniticationRepository;@Autowiredpublic Core core;...B -> 核心public class Core {    private int id;    private String name;    private Date date;    public Core(int id, String name, Date date) {        this.id = id;        this.name = name;        this.date = date;    }    public int getId() {        return id;    }    public void setId(int id) {        this.id = id;    }    public String getName() {        return name;    }    public void setName(String name) {        this.name = name;    }    public Date getDate() {        return date;    }    public void setDate(Date date) {        this.date = date;    }}错误com.demo.xyz.A.RestControllers.Route 中的 FieldcommunicationRepository 需要一个无法找到的“com.demo.xyz.A.CommunicationRepository”类型的 bean。行动:考虑在您的配置中定义一个“com.demo.xyz.A.CommunicationRepository”类型的 bean。A - > REPOSITORY.JAVA@Component@Repositorypublic interface CommunicationRepository extends CrudRepository<Communication, Date> {    List<Communication> findByDate(Date date);    void countByDate(Date date);}
查看完整描述

3 回答

  • 3 回答
  • 0 关注
  • 88 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信