1

I use Java configuration for my Spring MVC based webapp. I have implemented the WebApplicationInitializer interface of Spring framework.

    public class MyInitializer implements WebApplicationInitializer {
    ...
    @Override
    public void onStartup(final ServletContext servletContext) throws ServletException {
    //all the code for setting context
    }
    ...
    }

Now, I want to create a Main class as another entry point (for testing and other purposes) where I would like to Autowire my beans. For setting context I would like to use the same method here (this would prevent recopying the code). How can I do this ?

articuno
  • 546
  • 5
  • 12
  • You may consider checking out this [question](http://stackoverflow.com/questions/24175002/how-to-run-tests-using-a-custom-webapplicationinitializer) – Harsh Poddar Aug 10 '15 at 06:58

0 Answers0