Skip to content

Commit

Permalink
Fix incorrect warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
elandau committed Aug 17, 2016
1 parent e5e5f65 commit ed7708d
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 ed7708d

Please sign in to comment.