SpringFox bug on Spring Boot 2.6.x
https://gist.github.com/gabizinha12/b7617e261fda2a188db912ced27d833a https://gist.github.com/gabizinha12/1001d25330d0f359cf7e3b38061c14e7 Im using spring version 2.6.4, my springfox version is 3.0.0. I've tried changing path matchers, isnt any other way to workaround this version of springfox to work with Spring Boot 2.6.x? https://github.com/gabizinha12/api-petshop
add bean:
@Bean
public BeanPostProcessor springfoxHandlerProviderBeanPostProcessor() {
return new BeanPostProcessor() {
@Override
@SuppressWarnings({"NullableProblems", "unchecked"})
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
if (bean instanceof WebMvcRequestHandlerProvider || bean instanceof WebFluxRequestHandlerProvider) {
try {
Field field = ReflectionUtils.findField(bean.getClass(), "handlerMappings");
if (null != field) {
field.setAccessible(true);
List<RequestMappingInfoHandlerMapping> mappings = (List<RequestMappingInfoHandlerMapping>) field.get(bean);
mappings.removeIf(e -> null != e.getPatternParser());
}
} catch (IllegalArgumentException | IllegalAccessException e) {
throw new IllegalStateException(e);
}
}
return bean;
}
};
}
and application.yml
spring:
mvc:
pathmatch:
matching-strategy: ant_path_matcher
I've tried using the ant path matcher, does it have to be especifically YML? Not .properties?
On Mon, Mar 14, 2022 at 6:18 AM bell0521 @.***> wrote:
add bean: @Bean public BeanPostProcessor springfoxHandlerProviderBeanPostProcessor() { return new BeanPostProcessor() { @Override @SuppressWarnings({"NullableProblems", "unchecked"}) public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { if (bean instanceof WebMvcRequestHandlerProvider || bean instanceof WebFluxRequestHandlerProvider) { try { Field field = ReflectionUtils.findField(bean.getClass(), "handlerMappings"); if (null != field) { field.setAccessible(true); List<RequestMappingInfoHandlerMapping> mappings = (List<RequestMappingInfoHandlerMapping>) field.get(bean); mappings.removeIf(e -> null != e.getPatternParser()); } } catch (IllegalArgumentException | IllegalAccessException e) { throw new IllegalStateException(e); } } return bean; } }; }
and application.yml spring: mvc: pathmatch: matching-strategy: ant_path_matcher
— Reply to this email directly, view it on GitHub https://github.com/springfox/springfox/issues/3982#issuecomment-1066549843, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQGKNNL3LF4JBIYLMOWKM5DU7377XANCNFSM5QAR55MQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you authored the thread.Message ID: @.***>
spring.mvc.pathmatch.matching-strategy=ant_path_matcher
I've tried using the ant path matcher, does it have to be especifically YML? Not .properties? … On Mon, Mar 14, 2022 at 6:18 AM bell0521 @.> wrote: add bean: @bean public BeanPostProcessor springfoxHandlerProviderBeanPostProcessor() { return new BeanPostProcessor() { @OverRide @SuppressWarnings({"NullableProblems", "unchecked"}) public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { if (bean instanceof WebMvcRequestHandlerProvider || bean instanceof WebFluxRequestHandlerProvider) { try { Field field = ReflectionUtils.findField(bean.getClass(), "handlerMappings"); if (null != field) { field.setAccessible(true); List<RequestMappingInfoHandlerMapping> mappings = (List<RequestMappingInfoHandlerMapping>) field.get(bean); mappings.removeIf(e -> null != e.getPatternParser()); } } catch (IllegalArgumentException | IllegalAccessException e) { throw new IllegalStateException(e); } } return bean; } }; } and application.yml spring: mvc: pathmatch: matching-strategy: ant_path_matcher — Reply to this email directly, view it on GitHub <#3982 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQGKNNL3LF4JBIYLMOWKM5DU7377XANCNFSM5QAR55MQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you authored the thread.Message ID: @.>
spring mvc pathmatch matching-strategy: ant_path_matcher
the issue seems to be that if you're using spring actuator, setting the matching strategy won't help.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically closed because it has not had recent activity. Please re-open a new issue if this is still an issue.