diff --git a/spring-boot-ops/pom.xml b/spring-boot-ops/pom.xml index f36434b682..f578a24163 100644 --- a/spring-boot-ops/pom.xml +++ b/spring-boot-ops/pom.xml @@ -85,11 +85,17 @@ ${jquery.version} - + org.springframework.cloud spring-cloud-context ${springcloud.version} + + + org.apache.httpcomponents + httpclient + ${httpclient.version} + @@ -190,7 +196,8 @@ 2.2 18.0 3.1.7 - 2.0.2.RELEASE + 2.0.2.RELEASE + 4.5.8 diff --git a/spring-boot-ops/src/main/java/com/baeldung/properties/ConfProperties.java b/spring-boot-ops/src/main/java/com/baeldung/properties/ConfProperties.java index 0b6041bb06..c6413324f3 100644 --- a/spring-boot-ops/src/main/java/com/baeldung/properties/ConfProperties.java +++ b/spring-boot-ops/src/main/java/com/baeldung/properties/ConfProperties.java @@ -6,13 +6,13 @@ import org.springframework.stereotype.Component; @Component public class ConfProperties { - @Value("${url}") + @Value("${db.url}") private String url; - @Value("${username}") + @Value("${db.username}") private String username; - @Value("${password}") + @Value("${db.password}") private String password; public String getUrl() { diff --git a/spring-boot-ops/src/main/resources/external/conf.properties b/spring-boot-ops/src/main/resources/external/conf.properties index cfcd23dc76..944b31cc5c 100644 --- a/spring-boot-ops/src/main/resources/external/conf.properties +++ b/spring-boot-ops/src/main/resources/external/conf.properties @@ -1,4 +1,4 @@ -url=jdbc:postgresql://localhost:5432/ -username=admin -password=root +db.url=jdbc:postgresql://localhost:5432/ +db.username=admin +db.password=root spring.main.allow-bean-definition-overriding=true \ No newline at end of file diff --git a/spring-boot-ops/src/test/java/com/baeldung/restart/RestartApplicationIntegrationTest.java b/spring-boot-ops/src/test/java/com/baeldung/restart/RestartApplicationManualTest.java similarity index 84% rename from spring-boot-ops/src/test/java/com/baeldung/restart/RestartApplicationIntegrationTest.java rename to spring-boot-ops/src/test/java/com/baeldung/restart/RestartApplicationManualTest.java index 14e80c3ac7..35b488f9d8 100644 --- a/spring-boot-ops/src/test/java/com/baeldung/restart/RestartApplicationIntegrationTest.java +++ b/spring-boot-ops/src/test/java/com/baeldung/restart/RestartApplicationManualTest.java @@ -2,17 +2,16 @@ package com.baeldung.restart; import static org.junit.Assert.assertEquals; -import org.junit.After; -import org.junit.Before; import org.junit.Test; import org.springframework.boot.test.web.client.TestRestTemplate; -import org.springframework.boot.web.client.RestTemplateBuilder; import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; -import java.time.Duration; - -public class RestartApplicationIntegrationTest { +/** + * We have to make sure that while running this test, 8080 and 8090 ports are free. + * Otherwise it will fail. + */ +public class RestartApplicationManualTest { private TestRestTemplate restTemplate = new TestRestTemplate();