Spring RESTful Service as a WAR instead of JAR in Tomcat

前端 未结 3 2166
感动是毒
感动是毒 2020-12-15 19:21

I am in the process of creating a REST web service in Java Spring. I\'ve successfully loaded STS and the example detailed at :

\"This guide walks you through the pr

3条回答
  •  遥遥无期
    2020-12-15 19:49

    A WAR is just a JAR with special properites. It needs to have a WEB-INF, under which you need a web.xml to describe your deployment, any app server dependentXML configuration files, and usually a lib, classes, and other odds and ends.

    The easiest way would be to use Maven to create your WAR. I think you should be able to simply change the project type in the pom.xml from JAR to WAR. The tutorial you followed seems to use Gradle, which in turn uses Maven I believe, so you should have one there somewhere. Other than that, google for tutorials on how to construct a WAR. I don't believe that Tomcat requires any special deployment descriptors, so you should only need the web .xml.

提交回复
热议问题