Skip to content

Commit

Permalink
Merge pull request #432 from elandau/fix_proxy_configuration_source
Browse files Browse the repository at this point in the history
Fix incorrect warnings
  • Loading branch information
elandau authored Aug 17, 2016
2 parents 8971515 + ed7708d commit 6c5f521
Showing 1 changed file with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,18 @@ CascadeStrategy getCascadeStrategy() {

@Override
public <T> void onProvision(ProvisionInvocation<T> provision) {
if (injector == null) {
LOG.warn("Can't inject configuration until ConfigurationInjectingListener has been initialized");
return;
}

Class<?> clazz = provision.getBinding().getKey().getTypeLiteral().getRawType();

//
// Configuration Loading
//
final ConfigurationSource source = clazz.getDeclaredAnnotation(ConfigurationSource.class);
if (source != null) {
if (injector == null) {
LOG.warn("Can't inject configuration into {} until ConfigurationInjectingListener has been initialized", clazz.getName());
return;
}

CascadeStrategy strategy = source.cascading() != ConfigurationSource.NullCascadeStrategy.class
? injector.getInstance(source.cascading()) : getCascadeStrategy();

Expand All @@ -87,6 +87,11 @@ public <T> void onProvision(ProvisionInvocation<T> provision) {
//
Configuration configAnnot = clazz.getAnnotation(Configuration.class);
if (configAnnot != null) {
if (injector == null) {
LOG.warn("Can't inject configuration into {} until ConfigurationInjectingListener has been initialized", clazz.getName());
return;
}

try {
mapper.mapConfig(provision.provision(), config, new IoCContainer() {
@Override
Expand Down

0 comments on commit 6c5f521

Please sign in to comment.