I have implemented fileupload functionality using apache commons file upload library and implemented logic in doPost method of the servlet. Now I want to unit test doPost method fo the servlet and also how can I wire this servlet with the spring framework?
There is one suggestion of using one variable with @Autowire annotation in the servlet, not sure if that will work.
Any suggestions or thoughts would be highly appreciated.
you can include spring application context in a servlet by using a util class.
WebApplicationContextUtils.getRequiredWebApplicationContext(ServletContext sc)this would give you an instalce of the spring application context.. here on you can call spring services in your servlet.
refer here for documentation.