我在 APIREST 中使用了 swagger 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>
有人能幫幫我嗎?
uj5u.com熱心網友回復:
您可能正在為 GET 操作執行 PUT 呼叫,請檢查一次。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/484791.html
