Reputation: 1517
Let's take the simple example, where I have multiplication service as part of single monolithic MathService(deployed as war).
Now I need to deploy multiplication service as separate service(rest service) which MathService can call. The concept of dividing the single monolithic in to small maintainable service is microservice.
But I am not sure is it mandatory to deploy Multiplication service as war file? Can it be still deployed as jar file on the web server?
My understanding is that it should be war file as rest calls(HTTP call) needs to be handled by the servlet. Including servlet means it has to be war file. Is that correct?
Upvotes: 1
Views: 2913
Reputation: 1704
No.
Indeed, to work with web server, you would need a war file. But Web server just for receiving and responding network connections. You absolutely can manage connections by your self, with jdk or 3rd party libraries like netty. So you can just build a standalone java application, which actually can be called as a web server.
Upvotes: 1
Reputation: 5207
If you mean "can I deploy service without WAR?", then the answer is no, because the service should be a part of some WAR. If you mean "should every microservice be put to a separate WAR", the answer is not so simple. WAR should contain a single microservice. And dont think of microservice as a technically single end point, single REST or SOAP service, it can consist of several such services/endpoints.
Upvotes: 0
Reputation: 1008
No, it's not mandatory to deployed war file, microservices can also be deployed as jar or war file on the server.
you can also run your microservices as the jar file in external tomcat server Read this.
Upvotes: 1