Follow by Email

Thursday, November 22, 2012

spring get bean from applicationcontext

It's very simple thanks to powerfull Spring API , You can do it as mentioned below

  
 
ApplicationContext ctx = ContextLoader.getCurrentWebApplicationContext();   

 (UserCredentialsDataSourceAdapter)ctx.getBean("dataSource");