首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >.antMatchers(“/swagger/**”).permitAll()错误405

.antMatchers(“/swagger/**”).permitAll()错误405
EN

Stack Overflow用户
提问于 2022-06-01 02:21:14
回答 1查看 60关注 0票数 0

在我的APIREST中,我是无法避免的傲慢3,但是如果我尝试访问这个链接http://localhost:8080/swagger-ui/,就会出现一个405错误。

这是我的ConfigClass中的代码:

代码语言:javascript
运行
复制
 protected void configure(HttpSecurity http) throws Exception {
         http
            .csrf().disable()
            .exceptionHandling()
            .authenticationEntryPoint(authenticationEntryPoint)
            .and()
            .sessionManagement()
            .sessionCreationPolicy(SessionCreationPolicy.STATELESS)
            .and()
            .authorizeRequests()
            .antMatchers(HttpMethod.GET, "/api/v1/**").permitAll()
            .antMatchers("/api/v1/auth/**").permitAll()

            .antMatchers("/swagger-ui/**").permitAll()
            .antMatchers("/swagger-resources/**").permitAll()
            .antMatchers("/swagger-ui.html").permitAll()
            .antMatchers("/webjars/**").permitAll()
            .anyRequest()
            .authenticated();
    http.addFilterBefore(jwtAuthenticationFilter(), UsernamePasswordAuthenticationFilter.class);
}

这是POM.XML中的依赖项:

代码语言:javascript
运行
复制
     <dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-boot-starter</artifactId>
        <version>3.0.0</version>
    </dependency>

有人能帮我吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-06-01 02:30:23

您可能正在为GET操作做一个PUT呼叫,请检查一次。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72455831

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档