url全部加上/test
| 8 | * url全部加上/test |
| 9 | */ |
| 10 | @Configuration |
| 11 | public class WmsWebMvcConfig implements WebMvcConfigurer { |
| 12 | |
| 13 | private static final String BASE_PATH = "/test"; |
| 14 | |
| 15 | @Override |
| 16 | public void configurePathMatch(PathMatchConfigurer configurer) { |
| 17 | // 添加全局的基础路径 |
| 18 | configurer.setUseTrailingSlashMatch(true) |
| 19 | .addPathPrefix(BASE_PATH, this::isWmsController); |
| 20 | } |
| 21 | |
| 22 | // 只对 com.zc.wms 包下的控制器应用前缀 |
| 23 | private boolean isWmsController(Class<?> clazz) { |
| 24 | // 仅当类位于 com.yi.xm 包下时,才添加路径前缀 |
| 25 | return clazz.getPackage().getName().startsWith("com.yi.xm"); |
| 26 | } |
| 27 | |
| 28 | } |
nothing calls this directly
no outgoing calls
no test coverage detected