posted 17 years ago
Hi,
I have a bean definition as follows in my spring-context.xml file:
<bean id="myService"
class="com.try.services.MyServiceImpl"
singleton="true" lazy-init="true" autowire="constructor"
dependency-check="default" >
</bean>
and
public class MyServiceImpl extends BaseService implements MyService {
private AnotherService as;
public MyServiceImpl (SessionFactory sf, AnotherService as){
super(sf);
this.as = as;
}
}
'myService' bean is autowired by constructor.
what i understand by autowire='constructor' is :
create this bean instance using the constructor and arguments to the constructor are defined as other beans the spring-context.xml.
so i would have to write
<constructor-arg>..........</constructor-arg>
in the bean definition
but how does the above code work without the <onstructor-arg>
thanks,
Gayatri