admin管理员组文章数量:1335422
I have setup a spring boot project using spring boot version 3.3.5 and added springdoc version 2.6.0, this project also includes spring security and my Security config is as follow:
@Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
http.csrf(AbstractHttpConfigurer::disable)
.sessionManagement(
session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
.authorizeHttpRequests(
auth ->
auth.requestMatchers("/actuator/**")
.permitAll()
.requestMatchers("/v3/api-docs/**", "/swagger-ui/**", "/swagger-ui.html")
.permitAll()
.requestMatchers("/login")
.permitAll()
.requestMatchers("/reset-password")
.permitAll()
.requestMatchers("/validate-account")
.permitAll()
.requestMatchers("/fot-password")
.permitAll()
.requestMatchers("/validate-token")
.permitAll()
.anyRequest()
.authenticated());
http.authenticationProvider(authenticationProvider());
http.addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class);
return http.build();
}
The security config class is annotated with both @Configuration, @EnableWebSecurity and @EnableMethodSecurity(securedEnabled = true, jsr250Enabled = true)
Based on their official doc, including just the springdoc dependency it should expose the open api swagger definition under the path: /v3/api-docs which can be accessed as shown from the image but returns an empty response:
For the record, I'm using the following dependency 'cause I don't need the UI:
<dependency>
<groupId>.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-api</artifactId>
<version>${springdoc.version}</version>
</dependency>
本文标签: Open API definition empty with Sprint boot 3 and spring securityStack Overflow
版权声明:本文标题:Open API definition empty with Sprint boot 3 and spring security - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742387431a2465310.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论