shashidhar kumar wrote:Thanks Kathleen, Could you please explain, how bean gets 'prototype' scope ? If you have reference which I can take look into, please provide it.
When does duplicate setting in XML overwrite the setting in annotation ?
Let me clarify and correct my statement.
Below is the only documentation I found: from page 84 (or 108) of the Spring Framework documentation pdf in the spring-framework-3.0.7.RELEASE-with-docs download, or at
3.9 Annotation-based container configuration.
Annotation injection is performed before XML injection, thus the latter configuration will
override the former for properties wired through both approaches.
In terms of injection, above implies that when a property is able to find a value through both annotation and xml configuration, 2 settings will be done, whereby the annotation setting is the second, and therefore the final value.
With regards to if this applies to the 'scope', we may need to
test ourselves. I dont find the above statement clear if it applies to the attributes like 'scope'.
shashidhar kumar wrote:
<context:annotation-config />
<context:component-scan base-package="com.project.struts" />
Do the position of these two lines matter ?
There is no effect on the order of which the above-mentioned elements are declared in the xml file.