In my web spring application I create an instance with key word new
as following.
In my one of action class, following method exists.
publi
In your case, spring does not recognize MyBean
bean because you are creating it with new
operator. Let spring initialize this bean and then you can have autowired beans accessed inside MyBean
. For e.g.
Above entry in your application context will create MyBean
in spring container. And using this object you can access the services written inside it.