From c88ad331c0b6c02ea193afcce996d3b191fdeb8f Mon Sep 17 00:00:00 2001 From: Oliver Gierke Date: Wed, 21 Feb 2018 18:36:53 +0100 Subject: [PATCH] #553 - Upgrade to Spring Boot 2.3. --- .travis.yml | 3 +- .../src/main/java/example/Application.java | 61 ------------------- .../resources/application-deferred.properties | 1 + .../resources/application-lazy.properties | 1 + mongodb/util/pom.xml | 2 +- pom.xml | 2 +- redis/pom.xml | 5 -- solr/pom.xml | 5 -- 8 files changed, 6 insertions(+), 74 deletions(-) create mode 100644 jpa/deferred/src/main/resources/application-deferred.properties create mode 100644 jpa/deferred/src/main/resources/application-lazy.properties diff --git a/.travis.yml b/.travis.yml index 29fdf3f6..72150d9e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -46,6 +46,7 @@ install: - /opt/couchbase/bin/couchbase-cli user-manage -c 127.0.0.1:8091 -u Administrator -p password --set --rbac-username=travel-sample --rbac-password=password --roles=admin --auth-domain local script: + - cp -f settings.xml $HOME/.m2/settings.xml - mvn -version - java -version - - mvn clean dependency:list test -U -Dsort -Dmaven.test.redirectTestOutputToFile=true -B -s settings.xml + - mvn clean test -U -Dsort -Dmaven.test.redirectTestOutputToFile=true -B -s settings.xml diff --git a/jpa/deferred/src/main/java/example/Application.java b/jpa/deferred/src/main/java/example/Application.java index 9081f94b..5adf0dbb 100644 --- a/jpa/deferred/src/main/java/example/Application.java +++ b/jpa/deferred/src/main/java/example/Application.java @@ -15,21 +15,8 @@ */ package example; -import example.model.Customer; - -import javax.sql.DataSource; - import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Profile; -import org.springframework.core.env.Environment; -import org.springframework.data.jpa.repository.config.EnableJpaRepositories; -import org.springframework.data.repository.config.BootstrapMode; -import org.springframework.orm.jpa.JpaVendorAdapter; -import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; -import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; @SpringBootApplication public class Application { @@ -37,52 +24,4 @@ public class Application { public static void main(String[] args) { SpringApplication.run(Application.class); } - - /** - * Configures a {@link LocalContainerEntityManagerFactoryBean} to use background initialization for the {@code lazy} - * and {@code deferred} profiles. - * - * @author Oliver Gierke - */ - @Configuration - @Profile({ "lazy", "deferred" }) - static class LazyJpaConfiguration { - - @Bean - public LocalContainerEntityManagerFactoryBean entityManagerFactory(JpaVendorAdapter jpaVendorAdapter, - DataSource dataSource, Environment environment) { - - ThreadPoolTaskExecutor threadPoolTaskExecutor = new ThreadPoolTaskExecutor(); - threadPoolTaskExecutor.setDaemon(true); - threadPoolTaskExecutor.afterPropertiesSet(); - - LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean(); - emf.setBootstrapExecutor(threadPoolTaskExecutor); - emf.setDataSource(dataSource); - emf.setJpaVendorAdapter(jpaVendorAdapter); - emf.setPackagesToScan(Customer.class.getPackage().getName()); - - return emf; - } - } - - /** - * Bootstraps Spring Data JPA in lazy mode if the {@code lazy} profile is activated. - * - * @author Oliver Gierke - */ - @Profile("lazy") - @Configuration - @EnableJpaRepositories(bootstrapMode = BootstrapMode.LAZY) - static class LazyRepositoryConfiguration {} - - /** - * Bootstraps Spring Data JPA in deferred mode if the {@code deferred} profile is activated. - * - * @author Oliver Gierke - */ - @Profile("deferred") - @Configuration - @EnableJpaRepositories(bootstrapMode = BootstrapMode.DEFERRED) - static class DeferredRepositoryConfiguration {} } diff --git a/jpa/deferred/src/main/resources/application-deferred.properties b/jpa/deferred/src/main/resources/application-deferred.properties new file mode 100644 index 00000000..4b0e0f10 --- /dev/null +++ b/jpa/deferred/src/main/resources/application-deferred.properties @@ -0,0 +1 @@ +spring.data.jpa.repositories.bootstrap-mode=deferred diff --git a/jpa/deferred/src/main/resources/application-lazy.properties b/jpa/deferred/src/main/resources/application-lazy.properties new file mode 100644 index 00000000..1e79ef57 --- /dev/null +++ b/jpa/deferred/src/main/resources/application-lazy.properties @@ -0,0 +1 @@ +spring.data.jpa.repositories.bootstrap-mode=lazy diff --git a/mongodb/util/pom.xml b/mongodb/util/pom.xml index 175309d7..7907a452 100644 --- a/mongodb/util/pom.xml +++ b/mongodb/util/pom.xml @@ -20,7 +20,7 @@ org.mongodb - mongo-java-driver + mongodb-driver-sync diff --git a/pom.xml b/pom.xml index 8514ab88..1981f6b8 100644 --- a/pom.xml +++ b/pom.xml @@ -13,7 +13,7 @@ org.springframework.boot spring-boot-starter-parent - 2.2.5.RELEASE + 2.3.0.BUILD-SNAPSHOT diff --git a/redis/pom.xml b/redis/pom.xml index 96f9dfe4..27a797f6 100644 --- a/redis/pom.xml +++ b/redis/pom.xml @@ -32,11 +32,6 @@ spring-boot-starter-data-redis - - joda-time - joda-time - - diff --git a/solr/pom.xml b/solr/pom.xml index 9835048c..ea9d12be 100644 --- a/solr/pom.xml +++ b/solr/pom.xml @@ -27,11 +27,6 @@ org.springframework.boot spring-boot-starter-data-solr - - - joda-time - joda-time -