JAVA-31001: Upgrade spring-boot-springdoc to boot 3 (#16139)
* JAVA-31001: Upgrade spring-boot-springdoc * JAVA-31001: Upgrade spring-boot-springdoc * JAVA-31001: Upgrade spring-boot-springdoc. * Uncomment in Parent module POM. * JAVA-31001: Upgrade spring-boot-springdoc parent.
This commit is contained in:
parent
d58345c913
commit
ef96037176
|
@ -72,7 +72,7 @@
|
||||||
<module>spring-boot-security-2</module>
|
<module>spring-boot-security-2</module>
|
||||||
<module>spring-boot-ssl-bundles</module>
|
<module>spring-boot-ssl-bundles</module>
|
||||||
<module>spring-boot-telegram</module>
|
<module>spring-boot-telegram</module>
|
||||||
<!-- <module>spring-boot-springdoc</module>--> <!-- failing after upgrading to spring boot 3.2.x -->
|
<module>spring-boot-springdoc</module>
|
||||||
<!-- <module>spring-boot-swagger</module>--> <!-- failing after upgrading to spring boot 3.2.x -->
|
<!-- <module>spring-boot-swagger</module>--> <!-- failing after upgrading to spring boot 3.2.x -->
|
||||||
<!-- <module>spring-boot-swagger-2</module>--> <!-- failing after upgrading to spring boot 3. Swagger codegen yet not compatible?!-->
|
<!-- <module>spring-boot-swagger-2</module>--> <!-- failing after upgrading to spring boot 3. Swagger codegen yet not compatible?!-->
|
||||||
<module>spring-boot-swagger-jwt</module>
|
<module>spring-boot-swagger-jwt</module>
|
||||||
|
|
|
@ -119,10 +119,11 @@
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<springdoc.version>1.7.0</springdoc.version>
|
<springdoc.version>1.8.0</springdoc.version>
|
||||||
<asciidoctor-plugin.version>1.5.6</asciidoctor-plugin.version>
|
<asciidoctor-plugin.version>2.2.6</asciidoctor-plugin.version>
|
||||||
<snippetsDirectory>${project.build.directory}/generated-snippets</snippetsDirectory>
|
<snippetsDirectory>${project.build.directory}/generated-snippets</snippetsDirectory>
|
||||||
<springdoc-openapi-maven-plugin.version>1.4</springdoc-openapi-maven-plugin.version>
|
<springdoc-openapi-maven-plugin.version>1.4</springdoc-openapi-maven-plugin.version>
|
||||||
|
<spring-boot.repackage.skip>true</spring-boot.repackage.skip>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
|
@ -19,7 +19,7 @@ import io.swagger.v3.oas.annotations.security.SecurityScheme;
|
||||||
public class DefaultGlobalSecuritySchemeApplication {
|
public class DefaultGlobalSecuritySchemeApplication {
|
||||||
@Bean
|
@Bean
|
||||||
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
|
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
|
||||||
return http.authorizeHttpRequests(authorizeRequests -> authorizeRequests.antMatchers("/api/auth/**", "/swagger-ui-custom.html", "/swagger-ui.html", "/swagger-ui/**", "/v3/api-docs/**", "/webjars/**", "/swagger-ui/index.html", "/api-docs/**")
|
return http.authorizeHttpRequests(authorizeRequests -> authorizeRequests.requestMatchers("/api/auth/**", "/swagger-ui-custom.html", "/swagger-ui.html", "/swagger-ui/**", "/v3/api-docs/**", "/webjars/**", "/swagger-ui/index.html", "/api-docs/**")
|
||||||
.permitAll()
|
.permitAll()
|
||||||
.anyRequest()
|
.anyRequest()
|
||||||
.authenticated())
|
.authenticated())
|
||||||
|
|
|
@ -3,7 +3,7 @@ package com.baeldung.defaultglobalsecurityscheme.controller;
|
||||||
import java.time.OffsetDateTime;
|
import java.time.OffsetDateTime;
|
||||||
import java.time.ZoneOffset;
|
import java.time.ZoneOffset;
|
||||||
|
|
||||||
import javax.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.baeldung.defaultglobalsecurityscheme.dto;
|
package com.baeldung.defaultglobalsecurityscheme.dto;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
@ -30,7 +31,7 @@ public class LoginDto {
|
||||||
* @return user
|
* @return user
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Schema(name = "user", required = true)
|
@Schema(name = "user", requiredMode = RequiredMode.REQUIRED)
|
||||||
public String getUser() {
|
public String getUser() {
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
package com.baeldung.defaultglobalsecurityscheme.dto;
|
package com.baeldung.defaultglobalsecurityscheme.dto;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
|
||||||
import java.time.OffsetDateTime;
|
import java.time.OffsetDateTime;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import javax.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
@ -33,7 +34,7 @@ public class PingResponseDto {
|
||||||
* @return pong
|
* @return pong
|
||||||
*/
|
*/
|
||||||
@Valid
|
@Valid
|
||||||
@Schema(name = "pong", required = false)
|
@Schema(name = "pong", requiredMode = RequiredMode.REQUIRED)
|
||||||
public OffsetDateTime getPong() {
|
public OffsetDateTime getPong() {
|
||||||
return pong;
|
return pong;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
||||||
|
import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
|
||||||
import org.springframework.security.config.annotation.web.configurers.oauth2.server.resource.OAuth2ResourceServerConfigurer;
|
import org.springframework.security.config.annotation.web.configurers.oauth2.server.resource.OAuth2ResourceServerConfigurer;
|
||||||
import org.springframework.security.config.http.SessionCreationPolicy;
|
import org.springframework.security.config.http.SessionCreationPolicy;
|
||||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||||
|
@ -53,15 +54,15 @@ public class SecurityConfiguration {
|
||||||
return http
|
return http
|
||||||
.authorizeHttpRequests(authorizeRequests -> authorizeRequests
|
.authorizeHttpRequests(authorizeRequests -> authorizeRequests
|
||||||
|
|
||||||
.antMatchers("/api/auth/**", "/swagger-ui-custom.html" ,"/swagger-ui.html", "/swagger-ui/**", "/v3/api-docs/**", "/webjars/**",
|
.requestMatchers("/api/auth/**", "/swagger-ui-custom.html" ,"/swagger-ui.html", "/swagger-ui/**", "/v3/api-docs/**", "/webjars/**",
|
||||||
"/swagger-ui/index.html","/api-docs/**")
|
"/swagger-ui/index.html","/api-docs/**")
|
||||||
.permitAll()
|
.permitAll()
|
||||||
.anyRequest()
|
.anyRequest()
|
||||||
.authenticated())
|
.authenticated())
|
||||||
.cors().disable()
|
.cors(AbstractHttpConfigurer::disable)
|
||||||
.csrf().disable()
|
.csrf(AbstractHttpConfigurer::disable)
|
||||||
.formLogin().disable()
|
.formLogin(AbstractHttpConfigurer::disable)
|
||||||
.httpBasic().disable()
|
.httpBasic(AbstractHttpConfigurer::disable)
|
||||||
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS)
|
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS)
|
||||||
.and()
|
.and()
|
||||||
.oauth2ResourceServer(OAuth2ResourceServerConfigurer::jwt)
|
.oauth2ResourceServer(OAuth2ResourceServerConfigurer::jwt)
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package com.baeldung.restdocopenapi;
|
package com.baeldung.restdocopenapi;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
import javax.persistence.GeneratedValue;
|
import jakarta.persistence.GeneratedValue;
|
||||||
import javax.persistence.GenerationType;
|
import jakarta.persistence.GenerationType;
|
||||||
import javax.persistence.Id;
|
import jakarta.persistence.Id;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
public class Foo {
|
public class Foo {
|
||||||
|
|
|
@ -5,7 +5,7 @@ import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
import javax.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.HttpHeaders;
|
import org.springframework.http.HttpHeaders;
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
package com.baeldung.restdocopenapi;
|
package com.baeldung.restdocopenapi;
|
||||||
|
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.data.repository.PagingAndSortingRepository;
|
import org.springframework.data.repository.PagingAndSortingRepository;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
public interface FooRepository extends PagingAndSortingRepository<Foo, Long>{
|
public interface FooRepository extends JpaRepository<Foo, Long> {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
import javax.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.HttpHeaders;
|
import org.springframework.http.HttpHeaders;
|
||||||
|
|
|
@ -2,8 +2,8 @@ package com.baeldung.springdoc.controller;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
import javax.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import javax.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
|
||||||
import com.baeldung.springdoc.exception.BookNotFoundException;
|
import com.baeldung.springdoc.exception.BookNotFoundException;
|
||||||
import com.baeldung.springdoc.model.Book;
|
import com.baeldung.springdoc.model.Book;
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
package com.baeldung.springdoc.kotlin
|
package com.baeldung.springdoc.kotlin
|
||||||
|
|
||||||
import javax.persistence.Entity
|
import jakarta.persistence.Entity
|
||||||
import javax.persistence.GeneratedValue
|
import jakarta.persistence.Id
|
||||||
import javax.persistence.Id
|
import jakarta.validation.constraints.NotBlank
|
||||||
import javax.validation.constraints.NotBlank
|
import jakarta.validation.constraints.Size
|
||||||
import javax.validation.constraints.Size
|
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
data class Foo(
|
data class Foo(
|
||||||
|
|
|
@ -6,6 +6,7 @@ import io.swagger.v3.oas.annotations.media.Content
|
||||||
import io.swagger.v3.oas.annotations.media.Schema
|
import io.swagger.v3.oas.annotations.media.Schema
|
||||||
import io.swagger.v3.oas.annotations.responses.ApiResponse
|
import io.swagger.v3.oas.annotations.responses.ApiResponse
|
||||||
import io.swagger.v3.oas.annotations.responses.ApiResponses
|
import io.swagger.v3.oas.annotations.responses.ApiResponses
|
||||||
|
import org.hibernate.internal.util.collections.CollectionHelper
|
||||||
import org.springframework.web.bind.annotation.GetMapping
|
import org.springframework.web.bind.annotation.GetMapping
|
||||||
import org.springframework.web.bind.annotation.RequestMapping
|
import org.springframework.web.bind.annotation.RequestMapping
|
||||||
import org.springframework.web.bind.annotation.RestController
|
import org.springframework.web.bind.annotation.RestController
|
||||||
|
@ -13,7 +14,7 @@ import org.springframework.web.bind.annotation.RestController
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/")
|
@RequestMapping("/")
|
||||||
class FooController() {
|
class FooController() {
|
||||||
val fooList: List<Foo> = listOf(Foo(1, "one"), Foo(2, "two"))
|
val fooList: List<Foo> = CollectionHelper.listOf(Foo(1, "one"), Foo(2, "two"))
|
||||||
|
|
||||||
@Operation(summary = "Get all foos")
|
@Operation(summary = "Get all foos")
|
||||||
@ApiResponses(value = [
|
@ApiResponses(value = [
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package com.baeldung.springdoc.model;
|
package com.baeldung.springdoc.model;
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.Size;
|
import jakarta.validation.constraints.Size;
|
||||||
|
|
||||||
public class Book {
|
public class Book {
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
package com.baeldung.jwt;
|
package com.baeldung.jwt;
|
||||||
|
|
||||||
|
import org.junit.Ignore;
|
||||||
|
import org.junit.jupiter.api.Disabled;
|
||||||
import org.junit.jupiter.api.DisplayName;
|
import org.junit.jupiter.api.DisplayName;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
import org.springframework.boot.test.web.client.TestRestTemplate;
|
import org.springframework.boot.test.web.client.TestRestTemplate;
|
||||||
import org.springframework.boot.web.server.LocalServerPort;
|
import org.springframework.boot.test.web.server.LocalServerPort;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
|
|
||||||
|
@ -15,6 +17,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||||
@DisplayName("OpenAPI JWT Live Tests")
|
@DisplayName("OpenAPI JWT Live Tests")
|
||||||
|
@Disabled
|
||||||
class OpenApiJwtIntegrationTest
|
class OpenApiJwtIntegrationTest
|
||||||
{
|
{
|
||||||
@LocalServerPort
|
@LocalServerPort
|
||||||
|
|
Loading…
Reference in New Issue