Commit 682975f98c60483acc213675db125e43b3ba7af8

Authored by Dancovich
1 parent 0bac8554
Exists in master

Resolvido problema onde implementações concretas de

AbstractStaticContext armazenavam beans em uma mesma store (cada
implementação deveria representar uma store separada).
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/context/AbstractStaticContext.java
@@ -37,6 +37,9 @@ @@ -37,6 +37,9 @@
37 package br.gov.frameworkdemoiselle.internal.context; 37 package br.gov.frameworkdemoiselle.internal.context;
38 38
39 import java.lang.annotation.Annotation; 39 import java.lang.annotation.Annotation;
  40 +import java.util.Collections;
  41 +import java.util.HashMap;
  42 +import java.util.Map;
40 43
41 import br.gov.frameworkdemoiselle.annotation.Priority; 44 import br.gov.frameworkdemoiselle.annotation.Priority;
42 import br.gov.frameworkdemoiselle.annotation.StaticScoped; 45 import br.gov.frameworkdemoiselle.annotation.StaticScoped;
@@ -58,7 +61,7 @@ import br.gov.frameworkdemoiselle.configuration.Configuration; @@ -58,7 +61,7 @@ import br.gov.frameworkdemoiselle.configuration.Configuration;
58 @Priority(Priority.MIN_PRIORITY) 61 @Priority(Priority.MIN_PRIORITY)
59 public abstract class AbstractStaticContext extends AbstractCustomContext { 62 public abstract class AbstractStaticContext extends AbstractCustomContext {
60 63
61 - private final static Store store = createStore(); 64 + private final static Map<String, Store> staticStore = Collections.synchronizedMap(new HashMap<String, Store>());
62 65
63 /** 66 /**
64 * Constructs this context to control the provided scope 67 * Constructs this context to control the provided scope
@@ -69,11 +72,17 @@ public abstract class AbstractStaticContext extends AbstractCustomContext { @@ -69,11 +72,17 @@ public abstract class AbstractStaticContext extends AbstractCustomContext {
69 72
70 @Override 73 @Override
71 protected Store getStore() { 74 protected Store getStore() {
  75 + Store store = staticStore.get( this.getClass().getCanonicalName() );
  76 + if (store==null){
  77 + store = createStore();
  78 + staticStore.put(this.getClass().getCanonicalName(), store);
  79 + }
  80 +
72 return store; 81 return store;
73 } 82 }
74 83
75 @Override 84 @Override
76 protected boolean isStoreInitialized() { 85 protected boolean isStoreInitialized() {
77 - return store!=null; 86 + return staticStore!=null;
78 } 87 }
79 } 88 }