mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Revert "Add support for UTF-8 in application.properties"
This reverts commit d6a424f94c
.
Closes gh-5361
# Conflicts:
# spring-boot/src/test/resources/org/springframework/boot/env/test-encoded.properties
This commit is contained in:
parent
5f6be0152b
commit
daf0b081e7
@ -22,7 +22,6 @@ import java.util.Properties;
|
|||||||
import org.springframework.core.env.PropertiesPropertySource;
|
import org.springframework.core.env.PropertiesPropertySource;
|
||||||
import org.springframework.core.env.PropertySource;
|
import org.springframework.core.env.PropertySource;
|
||||||
import org.springframework.core.io.Resource;
|
import org.springframework.core.io.Resource;
|
||||||
import org.springframework.core.io.support.EncodedResource;
|
|
||||||
import org.springframework.core.io.support.PropertiesLoaderUtils;
|
import org.springframework.core.io.support.PropertiesLoaderUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -42,8 +41,7 @@ public class PropertiesPropertySourceLoader implements PropertySourceLoader {
|
|||||||
public PropertySource<?> load(String name, Resource resource, String profile)
|
public PropertySource<?> load(String name, Resource resource, String profile)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
if (profile == null) {
|
if (profile == null) {
|
||||||
Properties properties = PropertiesLoaderUtils
|
Properties properties = PropertiesLoaderUtils.loadProperties(resource);
|
||||||
.loadProperties(new EncodedResource(resource, "UTF-8"));
|
|
||||||
if (!properties.isEmpty()) {
|
if (!properties.isEmpty()) {
|
||||||
return new PropertiesPropertySource(name, properties);
|
return new PropertiesPropertySource(name, properties);
|
||||||
}
|
}
|
||||||
|
@ -46,13 +46,6 @@ public class PropertiesPropertySourceLoaderTests {
|
|||||||
assertThat(source.getProperty("test"), equalTo((Object) "properties"));
|
assertThat(source.getProperty("test"), equalTo((Object) "properties"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void loadPropertiesEncoded() throws Exception {
|
|
||||||
PropertySource<?> source = this.loader.load("encoded.properties",
|
|
||||||
new ClassPathResource("test-encoded.properties", getClass()), null);
|
|
||||||
assertThat(source.getProperty("test"), equalTo((Object) "prकperties"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void loadXml() throws Exception {
|
public void loadXml() throws Exception {
|
||||||
PropertySource<?> source = this.loader.load("test.xml",
|
PropertySource<?> source = this.loader.load("test.xml",
|
||||||
|
@ -1 +0,0 @@
|
|||||||
test=prकperties
|
|
Loading…
Reference in New Issue
Block a user