提交 24936c5a 编写于 作者: sinat_25235033's avatar sinat_25235033

change contextPathRef to CONTEXT_PATH_REF

上级 99c3a474
......@@ -16,7 +16,7 @@ public interface PathTreeProvider {
* eg: springboot context path is: server.servlet.context-path = v2
* tomcat context path is: <context path="v2">
*/
AtomicReference<String> contextPathRef = new AtomicReference<String>();
AtomicReference<String> CONTEXT_PATH_REF = new AtomicReference<>();
/**
* set context path
......@@ -24,7 +24,16 @@ public interface PathTreeProvider {
* @param contextPath context path
*/
default void setContextPath(String contextPath) {
contextPathRef.set(contextPath);
CONTEXT_PATH_REF.set(contextPath);
}
/**
* get context path
* Please sync with your server context path settings use setContextPath
* @return context path
*/
default String getContextPath() {
return CONTEXT_PATH_REF.get();
}
/**
......
......@@ -77,7 +77,7 @@ public class AnnotationPathTreeProvider implements PathTreeProvider {
}
}
}
return SurenessCommonUtil.attachContextPath(contextPathRef.get(), resource);
return SurenessCommonUtil.attachContextPath(getContextPath(), resource);
}
@Override
......@@ -100,7 +100,7 @@ public class AnnotationPathTreeProvider implements PathTreeProvider {
}
}
}
return SurenessCommonUtil.attachContextPath(contextPathRef.get(), resource);
return SurenessCommonUtil.attachContextPath(getContextPath(), resource);
}
public List<String> getScanPackages() {
......
......@@ -35,7 +35,7 @@ public class DocumentPathTreeProvider implements PathTreeProvider {
} else {
resourceSet = new HashSet<>();
}
return SurenessCommonUtil.attachContextPath(contextPathRef.get(), resourceSet);
return SurenessCommonUtil.attachContextPath(getContextPath(), resourceSet);
} catch (IOException e) {
logger.error("load config data from yaml file error: ", e);
throw new SurenessLoadDataException(e.getMessage());
......@@ -55,7 +55,7 @@ public class DocumentPathTreeProvider implements PathTreeProvider {
} else {
resourceSet = new HashSet<>();
}
return SurenessCommonUtil.attachContextPath(contextPathRef.get(), resourceSet);
return SurenessCommonUtil.attachContextPath(getContextPath(), resourceSet);
} catch (IOException e) {
logger.error("load config data from yaml file error: ", e);
throw new SurenessLoadDataException(e.getMessage());
......
......@@ -50,7 +50,7 @@ public class DocumentResourceDefaultProvider implements PathTreeProvider, Surene
} else {
resourceSet = new HashSet<>();
}
return SurenessCommonUtil.attachContextPath(contextPathRef.get(), resourceSet);
return SurenessCommonUtil.attachContextPath(getContextPath(), resourceSet);
} catch (IOException e) {
logger.error("load config data from yaml file error: ", e);
throw new SurenessLoadDataException(e.getMessage());
......@@ -70,7 +70,7 @@ public class DocumentResourceDefaultProvider implements PathTreeProvider, Surene
} else {
resourceSet = new HashSet<>();
}
return SurenessCommonUtil.attachContextPath(contextPathRef.get(), resourceSet);
return SurenessCommonUtil.attachContextPath(getContextPath(), resourceSet);
} catch (IOException e) {
logger.error("load config data from yaml file error: ", e);
throw new SurenessLoadDataException(e.getMessage());
......
......@@ -22,13 +22,13 @@ public class DatabasePathTreeProvider implements PathTreeProvider {
@Override
public Set<String> providePathData() {
return SurenessCommonUtil.attachContextPath(contextPathRef.get(), resourceService.getAllEnableResourcePath());
return SurenessCommonUtil.attachContextPath(getContextPath(), resourceService.getAllEnableResourcePath());
}
@Override
public Set<String> provideExcludedResource() {
return SurenessCommonUtil.attachContextPath(contextPathRef.get(), resourceService.getAllDisableResourcePath());
return SurenessCommonUtil.attachContextPath(getContextPath(), resourceService.getAllDisableResourcePath());
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册