Merge pull request #10427 from rozagerardo/rozagerardo/JAVA-3717_Update-articles-for-2.4.0--other-properties-modules--optional
[JAVA-3717] Update articles for 2.4.0 - other properties-related articles -- article improvement
This commit is contained in:
commit
1e2aa09bf7
@ -0,0 +1 @@
|
||||
bael.property1=value1
|
@ -1,6 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
@ -88,7 +89,6 @@
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-context</artifactId>
|
||||
<version>${springcloud.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@ -99,6 +99,18 @@
|
||||
|
||||
</dependencies>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-dependencies</artifactId>
|
||||
<version>${spring.cloud-version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<build>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<resources>
|
||||
@ -153,9 +165,8 @@
|
||||
<jpa.version>2.2</jpa.version>
|
||||
<guava.version>18.0</guava.version>
|
||||
<subethasmtp.version>3.1.7</subethasmtp.version>
|
||||
<springcloud.version>2.0.2.RELEASE</springcloud.version>
|
||||
<httpclient.version>4.5.8</httpclient.version>
|
||||
<spring-boot.version>2.3.3.RELEASE</spring-boot.version>
|
||||
<spring.cloud-version>2020.0.0</spring.cloud-version>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
|
@ -2,6 +2,7 @@ management.endpoints.web.exposure.include=*
|
||||
management.metrics.enable.root=true
|
||||
management.metrics.enable.jvm=true
|
||||
management.endpoint.restart.enabled=true
|
||||
spring.datasource.jmx-enabled=false
|
||||
spring.datasource.tomcat.jmx-enabled=false
|
||||
spring.main.allow-bean-definition-overriding=true
|
||||
management.endpoint.shutdown.enabled=true
|
||||
management.endpoint.shutdown.enabled=true
|
||||
spring.config.import=file:./additional.properties,optional:file:/Users/home/config/jdbc.properties
|
@ -0,0 +1,22 @@
|
||||
package com.baeldung.properties;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
@SpringBootTest
|
||||
public class ApplicationPropertyImportExternalFileIntegrationTest {
|
||||
|
||||
@Value("${bael.property1}")
|
||||
String baelProperty;
|
||||
|
||||
@Test
|
||||
public void whenExternalisedPropertiesLoadedUsinApplicationProperties_thenReadValues() throws IOException {
|
||||
assertEquals(baelProperty, "value1");
|
||||
}
|
||||
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
spring.datasource.password: 'password'
|
||||
spring.datasource.url: jdbc:mysql://localhost:3306/db_integration
|
||||
spring.datasource.username: user
|
||||
spring.datasource.password=password
|
||||
spring.datasource.url=jdbc:mysql://localhost:3306/db_integration
|
||||
spring.datasource.username=user
|
||||
bael.property=integrationValue
|
Loading…
x
Reference in New Issue
Block a user