spring-projects / spring-data-redis

Provides support to increase developer productivity in Java when using Redis, a key-value store. Uses familiar Spring concepts such as a template classes for core API usage and lightweight repository style data access.
https://spring.io/projects/spring-data-redis/
Apache License 2.0
1.77k stars 1.17k forks source link

Duplicate code in StringToPropertiesConverter class #3020

Open wendy512 opened 1 month ago

wendy512 commented 1 month ago
public class StringToPropertiesConverter implements Converter<String, Properties> {

    @Override
    public Properties convert(String source) {

        Properties info = new Properties();
        try (StringReader stringReader = new StringReader(source)) {
            info.load(stringReader);
        } catch (Exception ex) {
            throw new RedisSystemException("Cannot read Redis info", ex);
        }
        return info;
    }
}

Converting String type content into Properties has been defined in org.springframework.data.redis.connection.convert.Converters. Can I try to optimize and submit a PR?

mp911de commented 1 month ago

Feel free. We should actually deprecate StringToPropertiesConverter and use only the one from Converters.toProperties(…).