Permalink
Browse files

Chapter 1, Javadoc.

  • Loading branch information...
1 parent f101ba8 commit da6d61332798f5549e0be5a91ae4d0643b860b77 @mdeinum committed Apr 29, 2012
@@ -4,6 +4,7 @@
import javax.servlet.ServletException;
import javax.servlet.ServletRegistration;
+import org.springframework.context.annotation.Configuration;
import org.springframework.web.WebApplicationInitializer;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
@@ -12,12 +13,28 @@
import com.apress.prospringmvc.bookstore.web.config.WebMvcContextConfiguration;
/**
- * {@link WebApplicationInitializer} implementation for bootstrapping our web environment. Prior to the Servlet 3.0 specification
- * this wasn't possible.
+ * {@code WebApplicationInitializer} that will be called by Spring's {@code SpringServletContainerInitializer} as part
+ * of the JEE {@code ServletContainerInitializer} pattern. This class will be called on application startup and will
+ * configure our JEE and Spring configuration.
+ * <p/>
+ *
+ * It will first initializes our {@code AnnotationConfigWebApplicationContext} with the common {@link Configuration}
+ * classes: {@code InfrastructureContextConfiguration} and {@code TestDataContextConfiguration} using a typical JEE
+ * {@code ContextLoaderListener}.
+ * <p/>
+ *
+ * Next it creates a {@link DispatcherServlet}, being a normal JEE Servlet which will create on its turn a child
+ * {@code AnnotationConfigWebApplicationContext} configured with the Spring MVC {@code Configuration} classes
+ * {@code WebMvcContextConfiguration} and {@code WebflowContextConfiguration}. This Servlet will be registered using
+ * JEE's programmatical API support.
+ * <p/>
+ *
+ * Note: the {@code OpenEntityManagerInViewFilter} is only enabled for pages served soley via Spring MVC. For pages
+ * being served via WebFlow we configured WebFlow to use the JpaFlowExecutionListener.
*
* @author Marten Deinum
* @author Koen Serneels
- *
+ *
*/
public class BookstoreWebApplicationInitializer implements WebApplicationInitializer {
@@ -4,13 +4,19 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
+/**
+ * Controller shows the index page.
+ *
+ * @author Marten Deinum
+ * @author Koen Serneels
+ */
@Controller
public class IndexController {
@RequestMapping(value = "/index.htm")
public ModelAndView indexPage() {
- ModelAndView mav = new ModelAndView("/WEB-INF/views/index.jsp");
- mav.addObject("theModelKey", "Spring says HI!");
+ ModelAndView mav = new ModelAndView("/WEB-INF/views/index.jsp");
+ mav.addObject("theModelKey", "Spring says HI!");
return mav;
}
}
@@ -6,11 +6,11 @@
import com.apress.prospringmvc.bookstore.web.IndexController;
/**
- * Configuration for the MVC part of the application. Should only contain web related beans and configuration.
+ * Spring MVC configuration
*
* @author Marten Deinum
* @author Koen Serneels
- *
+ *
*/
@Configuration
public class WebMvcContextConfiguration {

0 comments on commit da6d613

Please sign in to comment.