Commit c567bdd2 by Jason Song

fix for Spring 4.1.2 that composite property source should extend EnumerablePropertySource

parent 6015c757
package com.ctrip.framework.apollo.spring.config;
import com.ctrip.framework.apollo.Config;
import java.util.Set;
import org.springframework.core.env.EnumerablePropertySource;
import org.springframework.core.env.PropertySource;
import com.ctrip.framework.apollo.Config;
/**
* Property source wrapper for Config
*
* @author Jason Song(song_s@ctrip.com)
*/
public class ConfigPropertySource extends PropertySource<Config> {
public class ConfigPropertySource extends EnumerablePropertySource<Config> {
private static final String[] EMPTY_ARRAY = new String[0];
public ConfigPropertySource(String name, Config source) {
super(name, source);
}
@Override
public String[] getPropertyNames() {
Set<String> propertyNames = this.source.getPropertyNames();
if (propertyNames.isEmpty()) {
return EMPTY_ARRAY;
}
return propertyNames.toArray(new String[propertyNames.size()]);
}
@Override
public Object getProperty(String name) {
return this.source.getProperty(name, null);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment