This week's book giveaway is in the Programmer Certification forum. We're giving away four copies of OCP Oracle Certified Professional Java SE 11 Programmer I Study Guide: Exam 1Z0-815 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
'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>
That's the whole point of autowiring ! You don't need to tell the container which beans to use. It will look for a bean whose type is SessionFactory, and another bean whose type is AnotherService, and wire them to MyServiceImpl.
Note that if Spring finds more than one bean of type SessionFactory or AnotherService, it will throw an exception. In this case, you will have to set the constructor args explicitly with the constructor-arg tag.