gs-rest-service-0.1.0.war复制到tomcat-9.0.0.M17\webapps\
打开server.xml,这Host节点,加入<Context path="/gs" docBase="gs-rest-service-0.1.0.war" debug="0" privileged="true"/>
gs相当于虚拟目录,docBaset填写相对应Host 的 appBase的地址,加后缀war
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true">
<!-- SingleSignOn valve, share authentication between web applications
Documentation at: /docs/config/valve.html -->
<!--
<Valve className="org.apache.catalina.authenticator.SingleSignOn" />
-->
<!-- Access log processes all example.
Documentation at: /docs/config/valve.html
Note: The pattern used is equivalent to using pattern="common" -->
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log" suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" />
<!-- Tomcat Manager Context -->
<Context path="/gs" docBase="gs-rest-service-0.1.0.war" debug="0" privileged="true"/>
</Host>
可以用地址访问:
http://localhost:8080/gs/greeting/