I want to convert spring xml to java configuration.
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
default-autowire="byName">
<bean name="car" type="Car" />
<bean name="tire" type="Tire" />
</beans>
I have two classes: Car and Tire.
public class Tire {
private String age;
}
public class Car {
private Tire tire;
// Spring calls this setter because default-autowire="byName" of xml configuration
public void setTire(Tire newTire) {
this.tire = newTire;
}
}
I'm not using @Inject nor @Autowired annotations, but spring autowires and it works. How can I change xml to java configuration without modifying Car and Tire classes?
Thanks in advance.