问题
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.
Anyone knows how to do it?
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.
回答1:
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
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
Have not used play myself
来源:https://stackoverflow.com/questions/44083919/microservice-configuration-in-play-2-framework