在我的APIREST中,我是无法避免的傲慢3,但是如果我尝试访问这个链接http://localhost:8080/swagger-ui/,就会出现一个405错误。
这是我的ConfigClass中的代码:
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中的依赖项:
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
<version>3.0.0</version>
</dependency>
有人能帮我吗?
发布于 2022-06-01 02:30:23
您可能正在为GET操作做一个PUT呼叫,请检查一次。
https://stackoverflow.com/questions/72455831
复制相似问题