我正在尝试使用微服务架构制作一个简单的Spring Boot Web 应用程序。
我有两个微服务,其实体定义如下:
Microservice 1 :
@Entity
public class Article {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String title;
private String Content;
}
Run Code Online (Sandbox Code Playgroud)
和
Microservice 2 :
@Entity
public class Tag {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String title;
}
Run Code Online (Sandbox Code Playgroud)
现在我想在我的Gateway中的这两个实体之间建立多对多关系。
我曾尝试使用 feign 客户端,如下所示:
Gateway :
@FeignClient(value = "article-service")
public interface ArticleClient {
@RequestMapping(value = "/articles/", method = RequestMethod.GET)
Set<Article> getArticleById(@RequestParam("id") Long id);
}
@FeignClient(value = …Run Code Online (Sandbox Code Playgroud)