diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index ed104b6..f91fafc 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -23,11 +23,11 @@ jobs: uses: actions/setup-java@v3 with: distribution: 'temurin' - java-version: 11 + java-version: 17 - name: Cache Gradle uses: actions/cache@v3 env: - java-version: 11 + java-version: 17 with: path: | ~/.gradle/caches @@ -48,11 +48,11 @@ jobs: - uses: actions/checkout@v3 with: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - - name: Set up JDK 11 + - name: Set up JDK 17 uses: actions/setup-java@v3 with: distribution: 'temurin' - java-version: 11 + java-version: 17 - name: Cache SonarCloud packages uses: actions/cache@v3 with: diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 45f232d..4f95c88 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -16,7 +16,7 @@ jobs: fail-fast: false matrix: os: [ ubuntu-latest, macos-latest, windows-latest ] - java: [ 11, 17 ] + java: [ 17, 19 ] needs: validation runs-on: ${{ matrix.os }} steps: diff --git a/build.gradle b/build.gradle index bde27a7..2853550 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ plugins { id "jacoco" } -sonarqube { +sonar { properties { property "sonar.projectKey", "graphql-java-kickstart_graphql-java-kickstart-samples" property "sonar.organization", "graphql-java-kickstart" @@ -27,8 +27,8 @@ subprojects { } compileJava { - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } test { @@ -37,7 +37,7 @@ subprojects { jacocoTestReport { reports { - xml.enabled = true + xml.required = true } } } diff --git a/editors/src/main/java/graphql/kickstart/sample/SecurityConfig.java b/editors/src/main/java/graphql/kickstart/sample/SecurityConfig.java index 175a410..5f6d1fb 100644 --- a/editors/src/main/java/graphql/kickstart/sample/SecurityConfig.java +++ b/editors/src/main/java/graphql/kickstart/sample/SecurityConfig.java @@ -1,16 +1,18 @@ package graphql.kickstart.sample; +import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; 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.WebSecurityConfigurerAdapter; +import org.springframework.security.web.SecurityFilterChain; @Configuration @EnableWebSecurity -class SecurityConfig extends WebSecurityConfigurerAdapter { +class SecurityConfig { - @Override - protected void configure(final HttpSecurity http) throws Exception { - http.authorizeRequests().anyRequest().permitAll(); + @Bean + public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { + http.authorizeHttpRequests().anyRequest().permitAll(); + return http.build(); } } diff --git a/file-upload/src/main/java/upload/UploadMutation.java b/file-upload/src/main/java/upload/UploadMutation.java index a621c10..00cff13 100644 --- a/file-upload/src/main/java/upload/UploadMutation.java +++ b/file-upload/src/main/java/upload/UploadMutation.java @@ -2,7 +2,7 @@ import graphql.kickstart.tools.GraphQLMutationResolver; import java.io.IOException; -import javax.servlet.http.Part; +import jakarta.servlet.http.Part; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; diff --git a/gradle.properties b/gradle.properties index 1fbecf8..4a749e0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,7 +1,5 @@ -LIB_GRAPHQL_SERVLET_VER=14.0.0 +LIB_GRAPHQL_SERVLET_VER=15.0.0 LIB_GRAPHQL_SPRING_BOOT_VER=15.0.0 LIB_GRAPHQL_TOOLS_VER=13.0.2 LIB_GRAPHQL_EXTENDED_VALIDATION_VER=19.1 -LIB_SPRING_BOOT_VER=2.7.6 -sourceCompatibility=11 -targetCompatibility=11 +LIB_SPRING_BOOT_VER=3.0.0 diff --git a/graphql-annotations/build.gradle b/graphql-annotations/build.gradle index 0f998b9..89de2e8 100644 --- a/graphql-annotations/build.gradle +++ b/graphql-annotations/build.gradle @@ -5,7 +5,7 @@ dependencies { implementation("org.springframework.boot:spring-boot-starter-web") implementation("org.springframework.boot:spring-boot-starter-data-jpa") - implementation "io.reactivex.rxjava2:rxjava" + implementation "io.reactivex.rxjava2:rxjava:2.2.21" implementation "org.projectlombok:lombok" annotationProcessor "org.projectlombok:lombok" runtimeOnly("com.h2database:h2") diff --git a/graphql-annotations/src/main/java/graphql/kickstart/spring/boot/graphql/annotations/example/model/type/Person.java b/graphql-annotations/src/main/java/graphql/kickstart/spring/boot/graphql/annotations/example/model/type/Person.java index 5fe00e9..7aa49f1 100644 --- a/graphql-annotations/src/main/java/graphql/kickstart/spring/boot/graphql/annotations/example/model/type/Person.java +++ b/graphql-annotations/src/main/java/graphql/kickstart/spring/boot/graphql/annotations/example/model/type/Person.java @@ -5,9 +5,9 @@ import graphql.annotations.annotationTypes.GraphQLNonNull; import graphql.kickstart.spring.boot.graphql.annotations.example.model.directives.UpperCaseDirective; import java.time.LocalDate; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; diff --git a/graphql-annotations/src/test/java/graphql/kickstart/spring/boot/graphql/annotations/example/CreatePersonTest.java b/graphql-annotations/src/test/java/graphql/kickstart/spring/boot/graphql/annotations/example/CreatePersonTest.java index 896229f..d740090 100644 --- a/graphql-annotations/src/test/java/graphql/kickstart/spring/boot/graphql/annotations/example/CreatePersonTest.java +++ b/graphql-annotations/src/test/java/graphql/kickstart/spring/boot/graphql/annotations/example/CreatePersonTest.java @@ -22,7 +22,7 @@ @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @Slf4j -public class CreatePersonTest { +class CreatePersonTest { private static final String FIRST_NAME = "John"; private static final String LAST_NAME = "Doe"; diff --git a/request-scoped-dataloader/src/main/java/graphql/servlet/examples/dataloader/requestscope/CustomGraphQLContextBuilder.java b/request-scoped-dataloader/src/main/java/graphql/servlet/examples/dataloader/requestscope/CustomGraphQLContextBuilder.java index 7f95cf1..06b3d9b 100644 --- a/request-scoped-dataloader/src/main/java/graphql/servlet/examples/dataloader/requestscope/CustomGraphQLContextBuilder.java +++ b/request-scoped-dataloader/src/main/java/graphql/servlet/examples/dataloader/requestscope/CustomGraphQLContextBuilder.java @@ -6,10 +6,10 @@ import graphql.kickstart.servlet.context.GraphQLServletContextBuilder; import java.util.HashMap; import java.util.Map; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.websocket.Session; -import javax.websocket.server.HandshakeRequest; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.websocket.Session; +import jakarta.websocket.server.HandshakeRequest; import org.dataloader.DataLoader; import org.dataloader.DataLoaderFactory; import org.dataloader.DataLoaderRegistry; diff --git a/servlet-hello-world/build.gradle b/servlet-hello-world/build.gradle index 4cf614b..fda3258 100644 --- a/servlet-hello-world/build.gradle +++ b/servlet-hello-world/build.gradle @@ -1,4 +1,4 @@ -def jettyVersion = '9.4.49.v20220914' +def jettyVersion = '11.0.12' dependencies { implementation "com.graphql-java-kickstart:graphql-java-servlet:$LIB_GRAPHQL_SERVLET_VER" @@ -7,8 +7,5 @@ dependencies { implementation 'org.slf4j:slf4j-simple:2.0.5' implementation "org.eclipse.jetty:jetty-webapp:${jettyVersion}" implementation "org.eclipse.jetty:jetty-annotations:${jettyVersion}" - implementation "org.eclipse.jetty.websocket:websocket-api:${jettyVersion}" - implementation "org.eclipse.jetty.websocket:websocket-server:${jettyVersion}" - implementation "org.eclipse.jetty.websocket:javax-websocket-server-impl:${jettyVersion}" - implementation "org.eclipse.jetty.websocket:websocket-common:${jettyVersion}" + implementation "org.eclipse.jetty.websocket:websocket-jetty-server:${jettyVersion}" } diff --git a/servlet-hello-world/src/main/java/hello/GraphQLWSEndpointConfigurer.java b/servlet-hello-world/src/main/java/hello/GraphQLWSEndpointConfigurer.java index c29b429..b9d0a99 100644 --- a/servlet-hello-world/src/main/java/hello/GraphQLWSEndpointConfigurer.java +++ b/servlet-hello-world/src/main/java/hello/GraphQLWSEndpointConfigurer.java @@ -1,8 +1,8 @@ package hello; -import javax.websocket.HandshakeResponse; -import javax.websocket.server.HandshakeRequest; -import javax.websocket.server.ServerEndpointConfig; +import jakarta.websocket.HandshakeResponse; +import jakarta.websocket.server.HandshakeRequest; +import jakarta.websocket.server.ServerEndpointConfig; public class GraphQLWSEndpointConfigurer extends ServerEndpointConfig.Configurator { diff --git a/servlet-hello-world/src/main/java/hello/HttpMain.java b/servlet-hello-world/src/main/java/hello/HttpMain.java index 5d82737..89672d2 100644 --- a/servlet-hello-world/src/main/java/hello/HttpMain.java +++ b/servlet-hello-world/src/main/java/hello/HttpMain.java @@ -1,10 +1,9 @@ package hello; -import javax.websocket.server.ServerEndpointConfig; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.ServerConnector; import org.eclipse.jetty.servlet.ServletContextHandler; -import org.eclipse.jetty.websocket.jsr356.server.deploy.WebSocketServerContainerInitializer; +import org.eclipse.jetty.websocket.server.config.JettyWebSocketServletContainerInitializer; class HttpMain { @@ -21,13 +20,10 @@ public static void main(String[] args) throws Exception { context.addServlet(HelloServlet.class, "/graphql"); server.setHandler(context); - WebSocketServerContainerInitializer.configure( + JettyWebSocketServletContainerInitializer.configure( context, (servletContext, serverContainer) -> - serverContainer.addEndpoint( - ServerEndpointConfig.Builder.create(SubscriptionEndpoint.class, "/subscriptions") - .configurator(new GraphQLWSEndpointConfigurer()) - .build())); + serverContainer.addMapping("/subscriptions", GraphQLWSEndpointConfigurer.class)); server.setHandler(context); diff --git a/spring-boot-commons.gradle b/spring-boot-commons.gradle index 7aa994d..1edc66f 100644 --- a/spring-boot-commons.gradle +++ b/spring-boot-commons.gradle @@ -1,7 +1,7 @@ // Common settings only needed for Spring Boot based samples apply plugin: "io.spring.dependency-management" -apply plugin: "org.springframework.boot" +//apply plugin: "org.springframework.boot" dependencyManagement { imports { diff --git a/spring-common/src/main/java/graphql/kickstart/autoconfigure/web/servlet/sample/schema/TodoSchema.java b/spring-common/src/main/java/graphql/kickstart/autoconfigure/web/servlet/sample/schema/TodoSchema.java index 473df40..d31b749 100644 --- a/spring-common/src/main/java/graphql/kickstart/autoconfigure/web/servlet/sample/schema/TodoSchema.java +++ b/spring-common/src/main/java/graphql/kickstart/autoconfigure/web/servlet/sample/schema/TodoSchema.java @@ -34,7 +34,7 @@ import java.util.Collection; import java.util.List; import java.util.stream.Collectors; -import javax.servlet.http.Part; +import jakarta.servlet.http.Part; @GraphQLSchema public class TodoSchema { diff --git a/subscription-with-authentication/src/main/java/subscription/MySubscriptionResolver.java b/subscription-with-authentication/src/main/java/subscription/MySubscriptionResolver.java index e3354e6..dce5f78 100644 --- a/subscription-with-authentication/src/main/java/subscription/MySubscriptionResolver.java +++ b/subscription-with-authentication/src/main/java/subscription/MySubscriptionResolver.java @@ -4,7 +4,7 @@ import graphql.kickstart.tools.GraphQLSubscriptionResolver; import graphql.schema.DataFetchingEnvironment; import java.util.Optional; -import javax.websocket.Session; +import jakarta.websocket.Session; import org.reactivestreams.Publisher; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/subscription-with-authentication/src/main/java/subscription/SecurityConfiguration.java b/subscription-with-authentication/src/main/java/subscription/SecurityConfiguration.java index 050aa24..e94d8e6 100644 --- a/subscription-with-authentication/src/main/java/subscription/SecurityConfiguration.java +++ b/subscription-with-authentication/src/main/java/subscription/SecurityConfiguration.java @@ -1,15 +1,16 @@ package subscription; +import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.web.builders.HttpSecurity; -import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; +import org.springframework.security.web.SecurityFilterChain; @Configuration -class SecurityConfiguration extends WebSecurityConfigurerAdapter { +class SecurityConfiguration { - @Override - protected void configure(HttpSecurity http) throws Exception { - http.authorizeRequests() + @Bean + public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { + http.authorizeHttpRequests() .anyRequest() .permitAll() .and() @@ -19,5 +20,6 @@ protected void configure(HttpSecurity http) throws Exception { .and() .logout() .permitAll(); + return http.build(); } } diff --git a/subscription/build.gradle b/subscription/build.gradle index be95286..2a081cf 100644 --- a/subscription/build.gradle +++ b/subscription/build.gradle @@ -11,7 +11,7 @@ dependencyManagement { dependencies { implementation("com.graphql-java-kickstart:graphql-spring-boot-starter") - implementation "io.reactivex.rxjava2:rxjava" + implementation "io.reactivex.rxjava2:rxjava:2.2.21" implementation "io.projectreactor:reactor-core" implementation("org.springframework.boot:spring-boot-starter-web") implementation("org.springframework.boot:spring-boot-starter-websocket")