Skip to content

ResourcePropertySource class should support to specify character encoding [SPR-13881] #18454

Closed

Description

@spring-projects-issues

rexli opened SPR-13881 and commented

When i use @PropertySources to load my properties file, i found that i can not specify character encoding.

Here is org.springframework.core.io.support.ResourcePropertySource source code:

public ResourcePropertySource(String name, Resource resource) throws IOException {
		super(name, PropertiesLoaderUtils.loadProperties(new EncodedResource(resource)));
		this.resourceName = getNameForResource(resource);
}

I want to specify character encoding like that:

PropertiesLoaderUtils.loadProperties(new EncodedResource(resource, "UTF-8"))

Affects: 4.1.7

Issue Links:

Activity

  1. spring-projects-issues commented on Jan 26, 2016

    @spring-projects-issues
    CollaboratorAuthor

    Juergen Hoeller commented

    For programmatic use of ResourcePropertySource, we already support a constructor variant with an EncodedResource argument; see #14729. We don't expose it in the @PropertySource annotation yet, which we're tracking in #18447.

    In any case, I'll mark this one as a duplicate.

    Juergen

  2. added
    type: enhancement
    in: core
    status: duplicate
    on Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: corestatus: duplicatetype: enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions