Play 2框架中的微服务配置 [英] Microservice Configuration in play 2 framework
问题描述
我已经在PLay 2中将应用程序划分为不同的项目,但是我只是意识到我不知道如何在同一服务器上运行多个播放应用程序.
I have divided my application into different projects in PLay 2. But I just realised I do not know how to run multiple play application in the same server.
有人知道怎么做吗?
让我们假设这是不可能的,因此,我将在同一个根项目中部署多个play应用程序(微服务将充当插件).您认为这会击败微服务架构吗?我将使每个模块独立运行.
Let us suppose it is not possible,Therefore, I will just deploy multiple play application in the same root project (The microservice will act as a plugin). Do you think this will defeat microservice architecture?. I will make each module act independently.
推荐答案
通过服务器,我猜你是说Tomcat/Jetty/其他容器/etc?您可以将每个服务部署在其自己的容器(tomcat)上,也可以将生成的WAR文件重命名为a.war
,b.war
,c.war
,在这种情况下,您可以访问localhost:8080/a
,localhost:8080/b
,等等
By server, I'm guessing you mean Tomcat / Jetty / other containers / etc ? You can either deploy each service on its own container (tomcat), or rename the generated WAR file to a.war
, b.war
, c.war
in which case you can access the different services at localhost:8080/a
, localhost:8080/b
, etc
如果您正在运行JAR,则需要弄清楚如何在自己的端口上运行每个服务,因为每个端口只能运行一个服务,例如localhost:8081
,localhost:8082
If you're running JARs, you need to figure out how to run each service on its own port since you can only run one service per port, eg localhost:8081
, localhost:8082
不习惯自己玩
这篇关于Play 2框架中的微服务配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!