From 37c49b85864dfe3e90b303139c28f0e1bc7d0994 Mon Sep 17 00:00:00 2001 From: Christopher Kolstad Date: Fri, 24 Nov 2023 11:02:47 +0100 Subject: [PATCH] chore(update): Bring spring-boot example up to speed with Spring Boot 3.2 and unleash-client 9.1.1 --- examples/spring-boot-example/build.gradle.kts | 7 ++++--- .../gradle/wrapper/gradle-wrapper.properties | 2 +- .../io/getunleash/unleash/example/UnleashSpringConfig.java | 7 ++++--- .../src/main/resources/application.yaml | 2 +- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/examples/spring-boot-example/build.gradle.kts b/examples/spring-boot-example/build.gradle.kts index 588d8220b..ac3e43b23 100644 --- a/examples/spring-boot-example/build.gradle.kts +++ b/examples/spring-boot-example/build.gradle.kts @@ -1,16 +1,17 @@ plugins { java - id("org.springframework.boot") version "3.0.0" - id("io.spring.dependency-management") version "1.1.0" + id("org.springframework.boot") version "3.2.0" + id("io.spring.dependency-management") version "1.1.4" } repositories { + mavenLocal() mavenCentral() } dependencies { implementation("org.springframework.boot:spring-boot-starter-web") - implementation("io.getunleash:unleash-client-java:8.2.0") + implementation("io.getunleash:unleash-client-java:9.1.1") testImplementation("org.springframework.boot:spring-boot-starter-test") } diff --git a/examples/spring-boot-example/gradle/wrapper/gradle-wrapper.properties b/examples/spring-boot-example/gradle/wrapper/gradle-wrapper.properties index ae04661ee..e411586a5 100644 --- a/examples/spring-boot-example/gradle/wrapper/gradle-wrapper.properties +++ b/examples/spring-boot-example/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/examples/spring-boot-example/src/main/java/io/getunleash/unleash/example/UnleashSpringConfig.java b/examples/spring-boot-example/src/main/java/io/getunleash/unleash/example/UnleashSpringConfig.java index cb0858761..74f1589f9 100644 --- a/examples/spring-boot-example/src/main/java/io/getunleash/unleash/example/UnleashSpringConfig.java +++ b/examples/spring-boot-example/src/main/java/io/getunleash/unleash/example/UnleashSpringConfig.java @@ -1,6 +1,5 @@ package io.getunleash.unleash.example; - import io.getunleash.DefaultUnleash; import io.getunleash.Unleash; import io.getunleash.util.UnleashConfig; @@ -12,9 +11,11 @@ public class UnleashSpringConfig { @Bean - public UnleashConfig unleashConfig(@Value("${unleash.url}") String url, @Value("${unleash.apikey}") String apiKey, @Value("${unleash.appname}") String appName) { + public UnleashConfig unleashConfig(@Value("${unleash.url}") String url, @Value("${unleash.apikey}") String apiKey, + @Value("${unleash.appname}") String appName) { UnleashConfig config = UnleashConfig.builder().unleashAPI(url).apiKey(apiKey).appName(appName) - .fetchTogglesInterval(15).build(); + .synchronousFetchOnInitialisation(true) + .fetchTogglesInterval(15).build(); return config; } diff --git a/examples/spring-boot-example/src/main/resources/application.yaml b/examples/spring-boot-example/src/main/resources/application.yaml index 23b02b4f3..2b2f6d4f7 100644 --- a/examples/spring-boot-example/src/main/resources/application.yaml +++ b/examples/spring-boot-example/src/main/resources/application.yaml @@ -1,4 +1,4 @@ unleash: - url: https://app.unleash-hosted.com/demo/api + url: https://app.unleash-hosted.com/demo/api12312312 apiKey: demo-app:production.614a75cf68bef8703aa1bd8304938a81ec871f86ea40c975468eabd6 appname: "Java-Spring-Boot-example"