Hi,
I am pretty new to Spring and I am trying to find my way in this.
In EJB in order to get stateless beans ref from anywhere in your project(from different classes) you could use jndi lookup or annotation injection.
How does it work with Spring?
should I use this code in each class which desire to get reference to a certain bean:
Or should I declare ApplicationContext in a Singleton class and then pass it's reference between the classes and then use context.getBean(..)HTML Code:ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml"); MyBean myBean= (MyBean ) context.getBean("MyBean");
?
thanks,
ray.


Reply With Quote
