[英]Spring Boot url endpoint
I'm trying to create a Spring Boot project whose endpoint is localhost:8080/ as opposed to localhost:8080/projectname/ 我正在尝试创建一个终结点为localhost:8080 /而不是localhost:8080 / projectname /的Spring Boot项目
My current mvcinitializer is as follows : 我当前的mvcinitializer如下:
public class SpringMvcInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
@Override
protected Class<?>[] getRootConfigClasses() {
return new Class[] { SpringRootConfig.class };
}
@Override
protected Class<?>[] getServletConfigClasses() {
return new Class[] { ThymeleafConfig.class };
}
@Override
protected String[] getServletMappings() {
return new String[] { "/" };
}
@Override
protected Filter[] getServletFilters() {
return new Filter[] {new EmailVerificationFilter()};
}
}
is there anyway for me to achieve the behavior described above? 反正我有实现上述行为的方法吗?
您可以只在application.properties文件中使用设置server.contextPath
:
server.contextPath=/projectname
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.