Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Injection must be made only once.

  • Loading branch information...
commit 2e46da6d29fc5e2b2550a0c2574a8d541688c73a 1 parent f3921f2
yjaigu authored
Showing with 4 additions and 1 deletion.
  1. +4 −1 framework/src/play/inject/Injector.java
View
5 framework/src/play/inject/Injector.java
@@ -24,7 +24,10 @@ public static void inject(BeanSource source) {
Class<?> type = field.getType();
field.setAccessible(true);
try {
- field.set(null, source.getBeanOfType(type));
+ final Object beanOfType = source.getBeanOfType(type);
+ if (field.get(null) == null && beanOfType != null) {
+ field.set(null, beanOfType);
+ }
} catch(RuntimeException e) {
throw e;
} catch(Exception e) {
Please sign in to comment.
Something went wrong with that request. Please try again.