diff --git a/spring-boot-modules/spring-boot-testing/src/main/java/com/baeldung/prevent/commandline/application/runner/execution/ApplicationRunnerTaskExecutor.java b/spring-boot-modules/spring-boot-testing/src/main/java/com/baeldung/prevent/commandline/application/runner/execution/ApplicationRunnerTaskExecutor.java index 3bf08491bf..8143b97f94 100644 --- a/spring-boot-modules/spring-boot-testing/src/main/java/com/baeldung/prevent/commandline/application/runner/execution/ApplicationRunnerTaskExecutor.java +++ b/spring-boot-modules/spring-boot-testing/src/main/java/com/baeldung/prevent/commandline/application/runner/execution/ApplicationRunnerTaskExecutor.java @@ -14,14 +14,16 @@ import org.springframework.stereotype.Component; matchIfMissing = true) @Component public class ApplicationRunnerTaskExecutor implements ApplicationRunner { - private TaskService taskService; + + private final TaskService taskService; public ApplicationRunnerTaskExecutor(TaskService taskService) { this.taskService = taskService; } @Override - public void run(ApplicationArguments args) throws Exception { + public void run(ApplicationArguments args) { taskService.execute("application runner task"); } + } diff --git a/spring-boot-modules/spring-boot-testing/src/main/java/com/baeldung/prevent/commandline/application/runner/execution/CommandLineTaskExecutor.java b/spring-boot-modules/spring-boot-testing/src/main/java/com/baeldung/prevent/commandline/application/runner/execution/CommandLineTaskExecutor.java index 38fd3b9c0a..0dd26eed8a 100644 --- a/spring-boot-modules/spring-boot-testing/src/main/java/com/baeldung/prevent/commandline/application/runner/execution/CommandLineTaskExecutor.java +++ b/spring-boot-modules/spring-boot-testing/src/main/java/com/baeldung/prevent/commandline/application/runner/execution/CommandLineTaskExecutor.java @@ -13,14 +13,14 @@ import org.springframework.stereotype.Component; matchIfMissing = true) @Component public class CommandLineTaskExecutor implements CommandLineRunner { - private TaskService taskService; + private final TaskService taskService; public CommandLineTaskExecutor(TaskService taskService) { this.taskService = taskService; } @Override - public void run(String... args) throws Exception { + public void run(String... args) { taskService.execute("command line runner task"); } } diff --git a/spring-boot-modules/spring-boot-testing/src/main/java/com/baeldung/prevent/commandline/application/runner/execution/TaskService.java b/spring-boot-modules/spring-boot-testing/src/main/java/com/baeldung/prevent/commandline/application/runner/execution/TaskService.java index dac437e72d..9190b12a22 100644 --- a/spring-boot-modules/spring-boot-testing/src/main/java/com/baeldung/prevent/commandline/application/runner/execution/TaskService.java +++ b/spring-boot-modules/spring-boot-testing/src/main/java/com/baeldung/prevent/commandline/application/runner/execution/TaskService.java @@ -6,9 +6,9 @@ import org.springframework.stereotype.Service; @Service public class TaskService { - private static Logger logger = LoggerFactory.getLogger(TaskService.class); + private static final Logger logger = LoggerFactory.getLogger(TaskService.class); public void execute(String task) { - logger.info("do " + task); + logger.info("do {}", task); } } diff --git a/spring-boot-modules/spring-boot-testing/src/test/java/com/baeldung/prevent/commandline/application/runner/execution/RunApplicationIntegrationTest.java b/spring-boot-modules/spring-boot-testing/src/test/java/com/baeldung/prevent/commandline/application/runner/execution/RunApplicationIntegrationTest.java index 26a7339f1d..43447ca178 100644 --- a/spring-boot-modules/spring-boot-testing/src/test/java/com/baeldung/prevent/commandline/application/runner/execution/RunApplicationIntegrationTest.java +++ b/spring-boot-modules/spring-boot-testing/src/test/java/com/baeldung/prevent/commandline/application/runner/execution/RunApplicationIntegrationTest.java @@ -1,16 +1,13 @@ package com.baeldung.prevent.commandline.application.runner.execution; -import org.junit.jupiter.api.Test; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.SpyBean; - -import com.baeldung.prevent.commandline.application.runner.execution.ApplicationRunnerTaskExecutor; -import com.baeldung.prevent.commandline.application.runner.execution.CommandLineTaskExecutor; - import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.mock.mockito.SpyBean; + @SpringBootTest class RunApplicationIntegrationTest { @SpyBean @@ -21,6 +18,6 @@ class RunApplicationIntegrationTest { @Test void whenContextLoads_thenRunnersRun() throws Exception { verify(applicationRunnerTaskExecutor, times(1)).run(any()); - verify(commandLineTaskExecutor, times(1)).run(any()); + verify(commandLineTaskExecutor, times(1)).run(any(String[].class)); } } diff --git a/spring-cloud-modules/spring-cloud-zuul-eureka-integration/eureka-client/pom.xml b/spring-cloud-modules/spring-cloud-zuul-eureka-integration/eureka-client/pom.xml index 952b7867de..d4a651f3dd 100644 --- a/spring-cloud-modules/spring-cloud-zuul-eureka-integration/eureka-client/pom.xml +++ b/spring-cloud-modules/spring-cloud-zuul-eureka-integration/eureka-client/pom.xml @@ -44,8 +44,18 @@ ${spring-boot.version} test + + net.bytebuddy + byte-buddy + ${byte-buddy.version} + test + + + 1.14.13 + + diff --git a/spring-cloud-modules/spring-cloud-zuul-eureka-integration/eureka-server/pom.xml b/spring-cloud-modules/spring-cloud-zuul-eureka-integration/eureka-server/pom.xml index 50169ff03a..de477f810a 100644 --- a/spring-cloud-modules/spring-cloud-zuul-eureka-integration/eureka-server/pom.xml +++ b/spring-cloud-modules/spring-cloud-zuul-eureka-integration/eureka-server/pom.xml @@ -44,8 +44,18 @@ ${spring-boot.version} test + + net.bytebuddy + byte-buddy + ${byte-buddy.version} + test + + + 1.14.13 + + diff --git a/spring-cloud-modules/spring-cloud-zuul/pom.xml b/spring-cloud-modules/spring-cloud-zuul/pom.xml index beb996521a..0e56ccfbdb 100644 --- a/spring-cloud-modules/spring-cloud-zuul/pom.xml +++ b/spring-cloud-modules/spring-cloud-zuul/pom.xml @@ -60,6 +60,12 @@ spring-boot-starter-test test + + net.bytebuddy + byte-buddy + ${byte-buddy.version} + test + @@ -82,6 +88,7 @@ 2021.0.3 2.2.7.RELEASE + 1.14.13 \ No newline at end of file diff --git a/spring-reactive-modules/spring-reactive-data-couchbase/pom.xml b/spring-reactive-modules/spring-reactive-data-couchbase/pom.xml index 7e09bf1770..d13706bbd5 100644 --- a/spring-reactive-modules/spring-reactive-data-couchbase/pom.xml +++ b/spring-reactive-modules/spring-reactive-data-couchbase/pom.xml @@ -65,6 +65,12 @@ ${couchbaseMock.version} test + + net.bytebuddy + byte-buddy + ${byte-buddy.version} + test + @@ -129,6 +135,7 @@ 11 11 11 + 1.14.13 \ No newline at end of file