Hello Forum,
since I'm kind of new to Spring itself I'm trying to use a Spring managed Object inside a class that is not managed by Spring.
I don't even know if this is possible, so excuse me if this question is totally out of logic. I'm just trying to learn Spring
Suppose I have the following applicationContext.xml that loads fine and all that.
And suppose I have a class Category that gets instantiated somewhere deep in the hierarchy of SimpleObject. Let's say that Category is a class representing a model or so.Code:<objects> ... <object class="com.example.util.ColorManager" id="colorManager"/> ... <object class="com.example.foo.SimpleObject"> <property name="colorManager" ref="colorManager"/> </object> </objects>
What I wann do now is that I want to call the colorManager inside of my Category Class. And I would like to use the one defined and instantiated in the container.
I also implemented the setter for the colorManager property. So I would have guessed that all classes are scanned and that objects that are not defined in the context get the appropriate beans assigned.Code:class Category { ... private var _colorManager:ColorManager; ... public function someFunctionName():Color { return this._colorManager.getColorForCategory(); } }
Or is this wrong?
Thanks for your help!
norman



Reply With Quote