Skip to content

Instantly share code, notes, and snippets.

@ck1125
Created August 21, 2012 01:23
Show Gist options
  • Save ck1125/3410292 to your computer and use it in GitHub Desktop.
Save ck1125/3410292 to your computer and use it in GitHub Desktop.
Propertysources extension
package com.in3k8.javaconfig.config.propertysource
import org.springframework.core.env.PropertySources
import org.springframework.core.env.PropertySource
class ListPropertySources implements PropertySources {
List<PropertySource<?>> propertySources
ListPropertySources(List<PropertySource<?>> propertySources) {
this.propertySources = propertySources
}
@Override
boolean contains(String name) {
return propertySources.find { PropertySource source ->
return source.named(name)
} != null
}
@Override
PropertySource<?> get(String name) {
return propertySources.find { PropertySource source ->
return source.named(name)
}
}
@Override
Iterator<PropertySource<?>> iterator() {
return propertySources.iterator()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment