hello2090
V2EX  ›  Java

请教一个 Springboot 配置的问题

  •  
  •   hello2090 · Sep 1, 2023 · 1659 views
    This topic created in 997 days ago, the information mentioned may be changed or developed.

    谢谢各位大佬指教

    长话短说,因为我用的 swagger-ui 3.0.0 版本和现在的 Springboot 2.7.15 版本不兼容,需要在application.properties 里加这么一个配置

    #spring.mvc.pathmath.matching-strategy = ANT_PATH_MATCHER

    想问问,有啥方法可以不用在 application.properties 里面配置,而是 code 里面配置,我没仔细看,不是很确定,继承 WebMvcConfigurer,重载他的configurePathMatch 可以吗?也就是

    @Override
    public void configurePathMatch(PathMatchConfigurer configurer) {
        configurer.setPathMatcher(new AntPathMatcher());
    }
    

    这和那句配置的效果是一样的吗?

    我当然还可以用 @EnableWebMvc 因为他会带进一个 antpathmatcher, 但我怕他带进别的配置搞乱现有的东西所以最好是像上面一样单独配置

    谢谢

    Edward4074
        1
    Edward4074  
       Sep 2, 2023 via iPhone
    我换成了 spring-doc
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   956 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 43ms · UTC 20:10 · PVG 04:10 · LAX 13:10 · JFK 16:10
    ♥ Do have faith in what you're doing.