java - Spring get current ApplicationContext -


I'm using Spring MVC for my web application my beans " spring-servlet.xml "The file is written

Now I have a class MyClass and I want to use this class using Spring Beans

I have written the following in spring-servlet.xml

  bean id = "miracles" category = "comm. MyClass" />   

Now let me get this ApplicationContext

  ApplicationContext context = ?? I need to use   

so that I can

  MyClass myClass = (MyClass) context.getBean ("myClass");   

How to do this ??

Just inject it. @Autowired Private ApplicationContext appContext;

Or apply this interface:

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -