137,7 → 137,7 |
|
// if you don't provide a scope the Scope is NONE |
// meaning a new instance is created on every |
// request for the component |
// request for the bean |
|
c.ioc("myString", String.class).addInitValue("saoj"); |
|
274,7 → 274,7 |
"connection" /* the source inside the container */); |
|
c.autowireBySetter("myDep" /* notice this is the setter of the Connection class */, |
"aDependency" /* again this is the name of the bean/component inside the container */); |
"aDependency" /* again this is the name of the factory inside the container */); |
|
return c; |
} |
354,7 → 354,7 |
public boolean isCleared() { return cleared; } |
} |
|
private static class SomeComponent implements Factory, Interceptable<SomeObject> { |
private static class SomeFactory implements Factory, Interceptable<SomeObject> { |
|
@Override |
public <T> T getInstance() { |
386,7 → 386,7 |
|
Container c = new MentaContainer(); |
|
c.ioc("o", new SomeComponent(), Scope.SINGLETON); |
c.ioc("o", new SomeFactory(), Scope.SINGLETON); |
|
SomeObject o = c.get("o"); |
|
394,7 → 394,7 |
|
Assert.assertEquals(true, o.isCleared()); |
|
c.ioc("o", new SomeComponent(), Scope.THREAD); |
c.ioc("o", new SomeFactory(), Scope.THREAD); |
|
o = c.get("o"); |
|
406,7 → 406,7 |
|
Assert.assertEquals(true, o.isCleared()); |
|
c.ioc("o", new SomeComponent(), Scope.NONE); |
c.ioc("o", new SomeFactory(), Scope.NONE); |
|
o = c.get("o"); |
|
414,7 → 414,7 |
|
Assert.assertNull(o); |
|
c.ioc("o", new SomeComponent(), Scope.THREAD); |
c.ioc("o", new SomeFactory(), Scope.THREAD); |
|
o = c.clear("o"); |
|