我希望spring petclinic application的根目录加载到:
http://localhost:8080/anothername
而不是:
http://localhost:8080/petclinic
如何在代码中进行更改以导致这种情况发生?我已经仔细检查过web.xml,mvc-core-config.xml和其他xml文件,但是我所做的任何更改似乎都没有更改url。
回答:
除了更改我在eclipse项目中可以找到的每个引用之外,缺少的部分是我还必须更改eclipse服务器项目内的server.xml文件中的以下代码行:
<Context docBase="newappname" path="/newappname" reloadable="true" source="org.eclipse.jst.jee.server:newappname"/></Host>
最佳答案
检查您的pom.xml
解决方法<path>
在
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.0</version>
<configuration>
<server>tomcat-development-server</server>
<port>9966</port>
<path>/petclinic</path>
</configuration>
</plugin>
用其他名称替换petclinic