It seems not the case. I used to have the notion that XML configurations are meant to override annotations. But when I set autowire=”no” in the XML configuration, the bean’s @Autowired annotated property still takes effect. I’m no longer sure if XML autowire has anything to do with @Autowired anymore. It’s quite counter-intuitive in my opinion.
Can someone point me to a documentation that says something about this?
Here’s my example:
<bean class="com.example.Tester"></bean>
<bean class="com.example.ClassToTest" autowire="no"></bean>
public class Tester
{
@Autowired
ClassToTest testSubject;
}
public class ClassToTest
{
@Autowired // I want this not to get autowired without removing this annotation
private OtherDependency;
}
autowire=”no” means we have to explicit wire our dependencies using either XML-based configuration or
@Autowireand it is default setting.Auto-wiring by xml configutaion or by annotation means implicitly mapping dependencies using given strategy.
For more details refer here