Permalink
Browse files

Injection must be made only once.

  • Loading branch information...
1 parent f3921f2 commit 2e46da6d29fc5e2b2550a0c2574a8d541688c73a yjaigu committed Oct 10, 2011
Showing with 4 additions and 1 deletion.
  1. +4 −1 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) {

0 comments on commit 2e46da6

Please sign in to comment.