pull/1/head
tanghc 5 years ago
parent d193035d69
commit 42abb033ab
  1. 12
      sop-common/sop-service-common/src/main/java/com/gitee/sop/servercommon/manager/ServiceRouteInfoBuilder.java

@ -79,7 +79,7 @@ public class ServiceRouteInfoBuilder {
} }
protected String buildServletPath(ServiceApiInfo serviceApiInfo, ServiceApiInfo.ApiMeta apiMeta) { protected String buildServletPath(ServiceApiInfo serviceApiInfo, ServiceApiInfo.ApiMeta apiMeta) {
String contextPath = environment.getProperty("server.servlet.context-path", getContextPathForOld()); String contextPath = getContextPathCompatibility();
String servletPath = apiMeta.getPath(); String servletPath = apiMeta.getPath();
if (servletPath == null) { if (servletPath == null) {
servletPath = ""; servletPath = "";
@ -95,11 +95,13 @@ public class ServiceRouteInfoBuilder {
} }
/** /**
* 兼容老版本获取context-path * 获取context-path兼容老版本
* @return 返回context-path没有返回/ * @return 返回context-path没有返回"/"
*/ */
private String getContextPathForOld() { private String getContextPathCompatibility() {
return environment.getProperty("server.context-path", DEFAULT_CONTEXT_PATH); return environment.getProperty("server.servlet.context-path",
environment.getProperty("server.context-path", DEFAULT_CONTEXT_PATH)
);
} }
private void checkPath(String path, String errorMsg) { private void checkPath(String path, String errorMsg) {

Loading…
Cancel
Save