Merge pull request #10432 from rozagerardo/rozagerardo/JAVA-3720_Update-articles-for-2.4.0--articles-using-profiles-1
[JAVA-3720] Update articles for 2.4.0 - articles using spring.profiles.* properties -- part 1
This commit is contained in:
commit
ed793f68ec
@ -11,6 +11,7 @@ app.name=MyApp
|
|||||||
app.description=${app.name} is a Spring Boot application
|
app.description=${app.name} is a Spring Boot application
|
||||||
logging.file.name=myapplication.log
|
logging.file.name=myapplication.log
|
||||||
bael.property=defaultValue
|
bael.property=defaultValue
|
||||||
|
bael.otherProperty=defaultOtherValue
|
||||||
#---
|
#---
|
||||||
spring.config.activate.on-profile=multidocument-dev
|
spring.config.activate.on-profile=multidocument-dev
|
||||||
spring.datasource.password=password
|
spring.datasource.password=password
|
||||||
@ -18,6 +19,9 @@ spring.datasource.url=jdbc:h2:dev
|
|||||||
spring.datasource.username=SA
|
spring.datasource.username=SA
|
||||||
bael.property=devValue
|
bael.property=devValue
|
||||||
#---
|
#---
|
||||||
|
spring.config.activate.on-profile=multidocument-integration-extension
|
||||||
|
bael.otherProperty=integrationExtensionOtherValue
|
||||||
|
#---
|
||||||
spring.config.activate.on-profile=multidocument-prod
|
spring.config.activate.on-profile=multidocument-prod
|
||||||
spring.datasource.password=password
|
spring.datasource.password=password
|
||||||
spring.datasource.url=jdbc:h2:prod
|
spring.datasource.url=jdbc:h2:prod
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
bael:
|
bael:
|
||||||
root-level-property: defaultRootLevelValue
|
root-level-property: defaultRootLevelValue
|
||||||
|
spring:
|
||||||
|
profiles:
|
||||||
|
group:
|
||||||
|
multidocument-integration: multidocument-integration-extension
|
||||||
---
|
---
|
||||||
spring:
|
spring:
|
||||||
config:
|
config:
|
||||||
|
@ -17,12 +17,16 @@ public class IntegrationMultidocumentFilesIntegrationTest {
|
|||||||
@Value("${bael.property}")
|
@Value("${bael.property}")
|
||||||
private String baelCustomProperty;
|
private String baelCustomProperty;
|
||||||
|
|
||||||
|
@Value("${bael.otherProperty}")
|
||||||
|
private String baelCustomOtherProperty;
|
||||||
|
|
||||||
@Value("${bael.root-level-property}")
|
@Value("${bael.root-level-property}")
|
||||||
private String baelRootProperty;
|
private String baelRootProperty;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void givenProductionProfileActive_whenApplicationStarts_thenDefaultPropertiesUser() {
|
public void givenProductionProfileActive_whenApplicationStarts_thenDefaultPropertiesUser() {
|
||||||
assertThat(baelCustomProperty).isEqualTo("integrationValue");
|
assertThat(baelCustomProperty).isEqualTo("integrationValue");
|
||||||
|
assertThat(baelCustomOtherProperty).isEqualTo("integrationExtensionOtherValue");
|
||||||
assertThat(baelRootProperty).isEqualTo("defaultRootLevelValue");
|
assertThat(baelRootProperty).isEqualTo("defaultRootLevelValue");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
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>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>client</artifactId>
|
<artifactId>client</artifactId>
|
||||||
<name>client</name>
|
<name>client</name>
|
||||||
@ -26,6 +26,17 @@
|
|||||||
<artifactId>spring-boot-starter-test</artifactId>
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.vintage</groupId>
|
||||||
|
<artifactId>junit-vintage-engine</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.hamcrest</groupId>
|
||||||
|
<artifactId>hamcrest-core</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
@ -33,8 +33,7 @@
|
|||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<spring-cloud-dependencies.version>Hoxton.SR4</spring-cloud-dependencies.version>
|
<spring-cloud-dependencies.version>2020.0.0</spring-cloud-dependencies.version>
|
||||||
<spring-boot.version>2.3.3.RELEASE</spring-boot.version>
|
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
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>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>server</artifactId>
|
<artifactId>server</artifactId>
|
||||||
<name>server</name>
|
<name>server</name>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.baeldung.spring.cloud</groupId>
|
<groupId>com.baeldung.spring.cloud</groupId>
|
||||||
<artifactId>spring-cloud-config</artifactId>
|
<artifactId>spring-cloud-config</artifactId>
|
||||||
@ -30,6 +30,17 @@
|
|||||||
<artifactId>spring-boot-starter-test</artifactId>
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.vintage</groupId>
|
||||||
|
<artifactId>junit-vintage-engine</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.hamcrest</groupId>
|
||||||
|
<artifactId>hamcrest-core</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user