• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

Spring Contaniner object - how to get in java

 
Ranch Hand
Posts: 113
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi ,
I have defined a class in spring-Config.xml as below
<bean id="testClass" class="com.test.TestClass" scope="session">
<aop:scoped-proxy />
</bean>

defining it in Spring-Config.xml make sure that spring will create an object of it and will use it. now while writing the code in my utility class. I also want to access this instance and use it.
can I get and the same instance which spring has created. if yes please let me know how to get this same instance in java.


thanks,
 
Ranch Hand
Posts: 101
Spring Flex Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try this
http://blog.imaginea.com/making-a-spring-bean-applicationcontext-aware/
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Shasi Mitra wrote:Try this
http://blog.imaginea.com/making-a-spring-bean-applicationcontext-aware/



Actually, that isn't necessary because you are using the <aop:scoped-proxy> tag.

Just create a bean for your utility class and inject it into the testClass, just like any other dependency injection.

Mark
 
reply
    Bookmark Topic Watch Topic
  • New Topic