如何使用spring boot制作一个通用的库 [英] How to use spring boot making a common library

查看:170
本文介绍了如何使用spring boot制作一个通用的库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在我想为我们的系统开发一个通用的邮件服务。
在设计时,我们想要开发一个 RabbitMQ 生产者和消费者。在消费者方面,我们可以开发和部署 Spring Boot Spring Cloud 应用程序,但在生产者方面,我们希望给出一个像下面这个界面的公共邮件客户端,并为其他系统创建一个jar依赖。

Now I want to develop a common mail service for our systems. As we design, we want to develop a RabbitMQ producer and consumer. On consumer side, we could develop and deploy a Spring Boot or Spring Cloud application, but on producer side we want to give a common mail client like the interface below and make a jar dependency for other system.

interface MailClient {
  ListentableFuture send(Message message);
}

但我看到使用许多声明方法的spring boot和spring cloud,似乎必须使用一个应用程序类,但我只想要一个类引用而不需要部署。我不知道如何实现它。

But i see spring boot and spring cloud using many declarative method and seems must use a application class, but i just want a class reference and not need deploy. i do not know how to implement it.

推荐答案

根据文档


Spring Boot可以轻松创建独立, 生产等级
基于Spring的应用程序,您可以直接运行。

Spring Boot makes it easy to create stand-alone, production-grade Spring based Applications that you can "just run".

但Spring Boot不是适用于所有情况的银弹。如果要创建库,可以创建一个常规的spring项目来构建jar并将其存储在公司的存储库中(如果有的话)。

But Spring Boot is not the silver bullet which matches all situations. If you want to create a library, you can create a regular spring project which builds a jar and stores it in your company's repository, if you have one.

这篇关于如何使用spring boot制作一个通用的库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆