[JAVA-13976] Upgrade Spring Boot to 2.7.2 (#12603)

* [JAVA-13976] Upgrade Spring Boot to 2.7.2

* [JAVA-13976] Fix failing test due to incorrect Jackson version
This commit is contained in:
Haroon Khan 2022-08-22 18:17:32 +01:00 committed by GitHub
parent a20006b451
commit b9789c23f0
43 changed files with 127 additions and 115 deletions

View File

@ -36,12 +36,10 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>${h2.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
@ -51,13 +49,12 @@
<dependency>
<groupId>com.graphql-java</groupId>
<artifactId>graphql-spring-boot-starter-test</artifactId>
<scope>test</scope>
<version>${graphql-spring-boot-starter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.skyscreamer</groupId>
<artifactId>jsonassert</artifactId>
<version>${jsonassert.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
@ -65,7 +62,6 @@
<properties>
<graphql-spring-boot-starter.version>5.0.2</graphql-spring-boot-starter.version>
<graphql-java-tools.version>5.2.4</graphql-java-tools.version>
<jsonassert.version>1.5.0</jsonassert.version>
</properties>
</project>

View File

@ -1,6 +1,6 @@
package com.baeldung.graphql.error.handling.exception;
import graphql.ErrorType;
import graphql.ErrorClassification;
import graphql.ExceptionWhileDataFetching;
import graphql.GraphQLError;
import graphql.language.SourceLocation;
@ -27,7 +27,7 @@ public class GraphQLErrorAdapter implements GraphQLError {
}
@Override
public ErrorType getErrorType() {
public ErrorClassification getErrorType() {
return error.getErrorType();
}

View File

@ -55,7 +55,7 @@
</build>
<properties>
<mustache.compiler.api.version>0.9.2</mustache.compiler.api.version>
<mustache.compiler.api.version>0.9.10</mustache.compiler.api.version>
<datafactory.version>0.8</datafactory.version>
<webjars.bootstrap.version>3.3.7</webjars.bootstrap.version>
</properties>

View File

@ -1,12 +1,11 @@
package com.baeldung.springmustache;
import com.samskivert.mustache.DefaultCollector;
import com.samskivert.mustache.Mustache;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.mustache.MustacheEnvironmentCollector;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.core.env.Environment;
@SpringBootApplication
@ComponentScan(basePackages = {"com.baeldung"})
@ -17,16 +16,11 @@ public class SpringMustacheApplication {
}
@Bean
public Mustache.Compiler mustacheCompiler(Mustache.TemplateLoader templateLoader, Environment environment) {
MustacheEnvironmentCollector collector = new MustacheEnvironmentCollector();
collector.setEnvironment(environment);
public Mustache.Compiler mustacheCompiler(Mustache.TemplateLoader templateLoader) {
return Mustache.compiler()
.defaultValue("Some Default Value")
.withLoader(templateLoader)
.withCollector(collector);
.withCollector(new DefaultCollector());
}
}

View File

@ -88,8 +88,8 @@
<rest-assured.version>3.3.0</rest-assured.version>
<!-- plugins -->
<thin.version>1.0.22.RELEASE</thin.version>
<spring-boot.version>2.6.4</spring-boot.version>
<spring-boot.version>2.7.2</spring-boot.version>
<aspectjweaver.version>1.9.1</aspectjweaver.version>
</properties>
</project>
</project>

View File

@ -19,7 +19,6 @@
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
<version>${flyway-core.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
@ -64,8 +63,8 @@
</build>
<properties>
<flyway-core.version>8.0.0</flyway-core.version>
<flyway-maven-plugin.version>8.0.0</flyway-maven-plugin.version>
<flyway-maven-plugin.version>8.5.13</flyway-maven-plugin.version>
<h2.version>2.1.214</h2.version>
</properties>
</project>

View File

@ -27,13 +27,8 @@
<dependency>
<groupId>de.flapdoodle.embed</groupId>
<artifactId>de.flapdoodle.embed.mongo</artifactId>
<version>${embed.mongo.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<properties>
<embed.mongo.version>3.2.6</embed.mongo.version>
</properties>
</project>

View File

@ -1,3 +1,5 @@
spring.datasource.url=jdbc:h2:mem:db;DB_CLOSE_DELAY=-1
spring.datasource.username=sa
spring.datasource.password=sa
spring.datasource.password=sa
spring.jpa.properties.hibernate.globally_quoted_identifiers=true

View File

@ -57,7 +57,6 @@
<dependency>
<groupId>de.flapdoodle.embed</groupId>
<artifactId>de.flapdoodle.embed.mongo</artifactId>
<version>${embed.mongo.version}</version>
<scope>test</scope>
</dependency>
<dependency>
@ -127,7 +126,6 @@
<spring-tx.version>5.3.15</spring-tx.version>
<httpclient.version>4.5.2</httpclient.version>
<reactor-core.version>3.3.1.RELEASE</reactor-core.version>
<embed.mongo.version>3.2.6</embed.mongo.version>
</properties>
</project>

View File

@ -9,3 +9,5 @@ spring:
jpa:
hibernate:
ddl-auto: create
properties:
globally_quoted_identifiers: true

View File

@ -8,4 +8,5 @@ spring:
ddl-auto: create-drop
properties:
hibernate:
dialect: org.hibernate.dialect.H2Dialect
dialect: org.hibernate.dialect.H2Dialect
globally_quoted_identifiers: true

View File

@ -583,7 +583,7 @@
<module>spring-jenkins-pipeline</module>
<module>spring-jersey</module>
<module>spring-jinq</module>
<!-- <module>spring-jinq</module> --> <!-- does not work with Spring Boot 2.7.2 -->
<module>spring-jms</module>
<module>spring-kafka</module>
@ -977,7 +977,7 @@
<module>spring-jenkins-pipeline</module>
<module>spring-jersey</module>
<module>spring-jinq</module>
<!-- <module>spring-jinq</module> --> <!-- does not support work with Spring Boot 2.7.2 -->
<module>spring-jms</module>
<module>spring-kafka</module>

View File

@ -41,7 +41,7 @@
</dependencies>
<properties>
<javers.version>6.5.3</javers.version>
<javers.version>6.6.5</javers.version>
</properties>
</project>

View File

@ -0,0 +1,16 @@
package com.baeldung.annotation.scanner;
import org.jobrunr.autoconfigure.JobRunrAutoConfiguration;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
@EnableAutoConfiguration(exclude = { JobRunrAutoConfiguration.class})
public class AnnotationScannerApp {
public static void main(String[] args) {
SpringApplication.run(AnnotationScannerApp.class, args);
}
}

View File

@ -1,4 +1,4 @@
package com.baeldung;
package com.baeldung.jobrunr;
import com.baeldung.jobrunr.service.SampleJobService;
import org.jobrunr.scheduling.JobScheduler;

View File

@ -1,4 +1,4 @@
package com.baeldung.config;
package com.baeldung.jobrunr.config;
import org.jobrunr.jobs.mappers.JobMapper;
import org.jobrunr.storage.InMemoryStorageProvider;

View File

@ -0,0 +1,13 @@
package com.baeldung.sprq;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SpqrApp {
public static void main(String[] args) {
SpringApplication.run(SpqrApp.class, args);
}
}

View File

@ -13,7 +13,7 @@ import org.springframework.test.context.junit4.SpringRunner;
import static org.junit.Assert.*;
@RunWith(SpringRunner.class)
@SpringBootTest
@SpringBootTest(classes = AnnotationScannerApp.class)
public class SampleAnnotationScannerUnitTest {
@Autowired
private List<SampleAnnotationScanner> scannerList;

View File

@ -1,6 +1,5 @@
package com.baeldung.jobrunr;
import org.awaitility.Awaitility;
import org.jobrunr.jobs.states.StateName;
import org.jobrunr.storage.StorageProvider;
import org.junit.Test;
@ -10,8 +9,6 @@ import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.test.context.junit4.SpringRunner;
import com.baeldung.JobRunrSpringBootApp;
import java.net.URI;
import java.util.concurrent.TimeUnit;

View File

@ -16,7 +16,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
@RunWith(SpringRunner.class)
@SpringBootTest
@SpringBootTest(classes = SpqrApp.class)
@AutoConfigureMockMvc
public class GraphqlControllerIntegrationTest {

View File

@ -77,7 +77,7 @@ public class PersistenceConfig {
final Properties hibernateProperties = new Properties();
hibernateProperties.setProperty("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto"));
hibernateProperties.setProperty("hibernate.dialect", env.getProperty("hibernate.dialect"));
// hibernateProperties.setProperty("hibernate.globally_quoted_identifiers", "true");
hibernateProperties.setProperty("hibernate.globally_quoted_identifiers", "true");
return hibernateProperties;
}

View File

@ -59,8 +59,7 @@ public class ErrorHandlingLiveTest {
webClient.getOptions()
.setThrowExceptionOnFailingStatusCode(false);
HtmlPage page = webClient.getPage(EXCEPTION_ENDPOINT);
assertThat(page.getBody()
.asText()).contains("Whitelabel Error Page");
assertThat(page.getBody().asNormalizedText()).contains("Whitelabel Error Page");
}
}
}

View File

@ -85,7 +85,7 @@
</dependencyManagement>
<properties>
<spring-cloud-dependencies.version>2021.0.0</spring-cloud-dependencies.version>
<spring-cloud-dependencies.version>2021.0.3</spring-cloud-dependencies.version>
<spring-cloud-starter-config.version>2.2.3.RELEASE</spring-cloud-starter-config.version>
<spring-cloud-config-server.version>2.2.3.RELEASE</spring-cloud-config-server.version>
<spring-cloud-starter-eureka.version>1.4.7.RELEASE</spring-cloud-starter-eureka.version>
@ -94,4 +94,4 @@
<spring-cloud-stream.version>3.1.3</spring-cloud-stream.version>
</properties>
</project>
</project>

View File

@ -33,7 +33,7 @@
</dependencyManagement>
<properties>
<spring-cloud-dependencies.version>2021.0.0</spring-cloud-dependencies.version>
<spring-cloud-dependencies.version>2021.0.3</spring-cloud-dependencies.version>
</properties>
</project>
</project>

View File

@ -33,7 +33,7 @@
</dependencyManagement>
<properties>
<spring-cloud-dependencies.version>2021.0.0</spring-cloud-dependencies.version>
<spring-cloud-dependencies.version>2021.0.3</spring-cloud-dependencies.version>
</properties>
</project>
</project>

View File

@ -32,6 +32,7 @@
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-kubernetes-config</artifactId>
<version>${spring.cloud.k8s.config.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
@ -54,6 +55,7 @@
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-kubernetes-ribbon</artifactId>
<version>${spring.cloud.k8s.config.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
@ -83,7 +85,8 @@
</build>
<properties>
<spring.cloud.k8s.version>1.1.8.RELEASE</spring.cloud.k8s.version>
<spring.cloud.k8s.version>2.1.3</spring.cloud.k8s.version>
<spring.cloud.k8s.config.version>1.1.10.RELEASE</spring.cloud.k8s.config.version>
</properties>
</project>
</project>

View File

@ -3,11 +3,8 @@ package com.baeldung.spring.cloud.kubernetes.client;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.ribbon.RibbonClient;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.ribbon.RibbonClient;
@SpringBootApplication
@EnableDiscoveryClient
@ -15,12 +12,6 @@ import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
@RibbonClient(name = "travel-agency-service", configuration = RibbonConfiguration.class)
public class Application {
@LoadBalanced
@Bean
RestTemplate restTemplate() {
return new RestTemplate();
}
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}

View File

@ -1,6 +1,15 @@
spring:
application.name: client-service
cloud.kubernetes.reload.enabled: true
cloud:
kubernetes:
reload:
enabled: true
discovery:
enabled: true
all-namespaces: false
primary-port-name: "default-http"
discovery-server-url: "http://myapp-discoveryserver"
include-not-ready-addresses: true
server.port: 8080
management:
endpoint:

View File

@ -33,7 +33,7 @@
</dependencyManagement>
<properties>
<spring-cloud-dependencies.version>2021.0.0</spring-cloud-dependencies.version>
<spring-cloud-dependencies.version>2021.0.3</spring-cloud-dependencies.version>
</properties>
</project>

View File

@ -64,7 +64,7 @@
</dependencies>
<properties>
<spring-cloud.version>2021.0.0</spring-cloud.version>
<spring-cloud.version>2021.0.3</spring-cloud.version>
</properties>
</project>
</project>

View File

@ -46,7 +46,7 @@
</dependencies>
<properties>
<spring-cloud-dependencies.version>2021.0.0</spring-cloud-dependencies.version>
<spring-cloud-dependencies.version>2021.0.3</spring-cloud-dependencies.version>
</properties>
</project>
</project>

View File

@ -33,7 +33,7 @@
</modules>
<properties>
<spring-cloud-dependencies.version>2021.0.0</spring-cloud-dependencies.version>
<spring-cloud-dependencies.version>2021.0.3</spring-cloud-dependencies.version>
</properties>
</project>
</project>

View File

@ -80,8 +80,8 @@
</build>
<properties>
<spring-cloud-dependencies.version>2021.0.0</spring-cloud-dependencies.version>
<spring-cloud-dependencies.version>2021.0.3</spring-cloud-dependencies.version>
<spring-cloud-netflix-zuul.version>2.2.7.RELEASE</spring-cloud-netflix-zuul.version>
</properties>
</project>
</project>

View File

@ -37,7 +37,6 @@
<dependency>
<groupId>de.flapdoodle.embed</groupId>
<artifactId>de.flapdoodle.embed.mongo</artifactId>
<version>${embed.mongo.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
@ -82,7 +81,6 @@
<properties>
<checkstyle.version>2.17</checkstyle.version>
<embed.mongo.version>3.2.6</embed.mongo.version>
</properties>
</project>
</project>

View File

@ -5,6 +5,8 @@ spring.jpa.show-sql = false
spring.jpa.hibernate.ddl-auto = create-drop
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.H2Dialect
spring.jpa.properties.hibernate.globally_quoted_identifiers=true
server.port=8082
server.servlet.context-path=/spring-katharsis

View File

@ -1,50 +1,50 @@
create table IF NOT EXISTS system_message (id integer not null, content varchar(255), primary key (id));
CREATE TABLE IF NOT EXISTS acl_sid (
id bigint(20) NOT NULL AUTO_INCREMENT,
principal tinyint(1) NOT NULL,
id bigint NOT NULL AUTO_INCREMENT,
principal tinyint NOT NULL,
sid varchar(100) NOT NULL,
PRIMARY KEY (id),
UNIQUE KEY unique_uk_1 (sid,principal)
CONSTRAINT unique_uk_1 UNIQUE (sid,principal)
);
CREATE TABLE IF NOT EXISTS acl_class (
id bigint(20) NOT NULL AUTO_INCREMENT,
id bigint NOT NULL AUTO_INCREMENT,
class varchar(255) NOT NULL,
PRIMARY KEY (id),
UNIQUE KEY unique_uk_2 (class)
CONSTRAINT unique_uk_2 UNIQUE (class)
);
CREATE TABLE IF NOT EXISTS acl_entry (
id bigint(20) NOT NULL AUTO_INCREMENT,
acl_object_identity bigint(20) NOT NULL,
ace_order int(11) NOT NULL,
sid bigint(20) NOT NULL,
mask int(11) NOT NULL,
granting tinyint(1) NOT NULL,
audit_success tinyint(1) NOT NULL,
audit_failure tinyint(1) NOT NULL,
id bigint NOT NULL AUTO_INCREMENT,
acl_object_identity bigint NOT NULL,
ace_order int NOT NULL,
sid bigint NOT NULL,
mask int NOT NULL,
granting tinyint NOT NULL,
audit_success tinyint NOT NULL,
audit_failure tinyint NOT NULL,
PRIMARY KEY (id),
UNIQUE KEY unique_uk_4 (acl_object_identity,ace_order)
CONSTRAINT unique_uk_4 UNIQUE (acl_object_identity,ace_order)
);
CREATE TABLE IF NOT EXISTS acl_object_identity (
id bigint(20) NOT NULL AUTO_INCREMENT,
object_id_class bigint(20) NOT NULL,
object_id_identity bigint(20) NOT NULL,
parent_object bigint(20) DEFAULT NULL,
owner_sid bigint(20) DEFAULT NULL,
entries_inheriting tinyint(1) NOT NULL,
id bigint NOT NULL AUTO_INCREMENT,
object_id_class bigint NOT NULL,
object_id_identity bigint NOT NULL,
parent_object bigint DEFAULT NULL,
owner_sid bigint DEFAULT NULL,
entries_inheriting tinyint NOT NULL,
PRIMARY KEY (id),
UNIQUE KEY unique_uk_3 (object_id_class,object_id_identity)
CONSTRAINT unique_uk_3 UNIQUE (object_id_class,object_id_identity)
);
ALTER TABLE acl_entry
ADD FOREIGN KEY (acl_object_identity) REFERENCES acl_object_identity(id);
ALTER TABLE acl_entry
ADD FOREIGN KEY (sid) REFERENCES acl_sid(id);
--
-- Constraints for table acl_object_identity
--

View File

@ -3,4 +3,6 @@ spring.social.facebook.appSecret=abefd6497e9cc01ad03be28509617bf0
spring.thymeleaf.cache=false
server.servlet.register-default-servlet=true
spring.sql.init.mode=always
spring.jpa.defer-datasource-initialization=true
spring.jpa.defer-datasource-initialization=true
spring.jpa.properties.hibernate.globally_quoted_identifiers=true

View File

@ -1 +1 @@
insert into User (id, username, password) values (1,'john', '123');
insert into "user" ("id", "username", "password") values (1,'john', '123');

View File

@ -32,7 +32,6 @@
<dependency>
<groupId>de.flapdoodle.embed</groupId>
<artifactId>de.flapdoodle.embed.mongo</artifactId>
<version>3.3.1</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>

View File

@ -78,7 +78,7 @@ public class PersistenceConfig {
final Properties hibernateProperties = new Properties();
hibernateProperties.setProperty("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto"));
hibernateProperties.setProperty("hibernate.dialect", env.getProperty("hibernate.dialect"));
// hibernateProperties.setProperty("hibernate.globally_quoted_identifiers", "true");
hibernateProperties.setProperty("hibernate.globally_quoted_identifiers", "true");
return hibernateProperties;
}

View File

@ -1,5 +1,5 @@
insert into User (id, firstName, lastName, email, age) values (1, 'john', 'doe', 'john@doe.com', 22);
insert into User (id, firstName, lastName, email, age) values (2, 'tom', 'doe', 'tom@doe.com', 26);
insert into "User" ("id", "firstName", "lastName", "email", "age") values (1, 'john', 'doe', 'john@doe.com', 22);
insert into "User" ("id", "firstName", "lastName", "email", "age") values (2, 'tom', 'doe', 'tom@doe.com', 26);
insert into MyUser (id, firstName, lastName, email, age) values (1, 'john', 'doe', 'john@doe.com', 22);
insert into MyUser (id, firstName, lastName, email, age) values (2, 'tom', 'doe', 'tom@doe.com', 26);
insert into "MyUser" ("id", "firstName", "lastName", "email", "age") values (1, 'john', 'doe', 'john@doe.com', 22);
insert into "MyUser" ("id", "firstName", "lastName", "email", "age") values (2, 'tom', 'doe', 'tom@doe.com', 26);

View File

@ -37,7 +37,6 @@
<dependency>
<groupId>de.flapdoodle.embed</groupId>
<artifactId>de.flapdoodle.embed.mongo</artifactId>
<version>${embed.mongo.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
@ -51,8 +50,4 @@
</plugins>
</build>
<properties>
<embed.mongo.version>3.2.6</embed.mongo.version>
</properties>
</project>
</project>

View File

@ -1,5 +1,6 @@
package com.baeldung.cucumber.tags.acceptance.commonutil;
import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
@ -34,7 +35,7 @@ public class ScenarioContextUI {
}
private static WebDriver getRemoteWebDriver(URL url) {
return new RemoteWebDriver(url, DesiredCapabilities.chrome());
return new RemoteWebDriver(url, new DesiredCapabilities("chrome", "", Platform.ANY));
}
private static WebDriver getLocalChromeDriver() {