我正在尝试在我的项目中的 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);}
添加回答
举报
0/150
提交
取消