场景: 当 app 和 admin 下的接口地址一致时(比如:/system/user/get),需要依赖前缀(admin-api | app-api)来区分,防止 URI 冲突。 问题: - 当 xss.enable=true 时,会触发 TechXssAutoConfiguration 中 xssJacksonCustomizer 的构建,间接触发 PathMatcher 注入,调用 DelegatingWebMvcConfiguration.configurePathMatch。 - 此时 RequestMappingHandlerMapping 的 mapping 还未加上前缀。 - 当 api-encrypt.enable=true 时,提前注入的 RequestMappingHandlerMapping 没有前缀,导致接口地址重复报错。 解决: - 不依赖 DelegatingWebMvcConfiguration 的回调顺序。 - 确保即使其他 Bean 提前触发 Mapping 创建时,也能正确加上前缀,避免 URI 冲突。 |
||
|---|---|---|
| .. | ||
| src | ||
| pom.xml | ||
| 《芋道 Spring Boot API 接口文档 Swagger 入门》.md | ||
| 《芋道 Spring Boot SpringMVC 入门》.md | ||