Improved spring-properties-file-outside-jar with new 2.4.0 feature
This commit is contained in:
@@ -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");
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user