Firebird Documentation IndexFirebird 3.0 Developer's GuideCreating an Application with jOOQ and Spring MVC → Start-up Code—WebInitializer
Firebird Home Firebird Home Prev: Coding the ConfigurationFirebird Documentation IndexUp: Creating an Application with jOOQ and Spring MVCNext: Generating classes for jOOQ

Start-up Code—WebInitializer

Now we'll get rid of the Web.xml file and create the WebInitializer.java class in its place:

package ru.ibase.fbjavaex.config;

import javax.servlet.ServletContext;  
import javax.servlet.ServletException;
import javax.servlet.ServletRegistration.Dynamic;  
  
import org.springframework.web.WebApplicationInitializer;  
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;  
import org.springframework.web.servlet.DispatcherServlet;  
  
public class WebInitializer implements WebApplicationInitializer {
    
    @Override
    public void onStartup(ServletContext servletContext) throws ServletException {        
        AnnotationConfigWebApplicationContext ctx = 
            new AnnotationConfigWebApplicationContext();  
        ctx.register(WebAppConfig.class);  
        ctx.setServletContext(servletContext);    
        Dynamic servlet = servletContext.addServlet("dispatcher", 
                                                    new DispatcherServlet(ctx));  
        servlet.addMapping("/");  
        servlet.setLoadOnStartup(1);
    }
    
}
      

All that is left to configure is IoC containers for injecting dependencies, a step we will return to later. We proceed next to generating classes for working with the database via Java Object-Oriented Querying (jOOQ).

Prev: Coding the ConfigurationFirebird Documentation IndexUp: Creating an Application with jOOQ and Spring MVCNext: Generating classes for jOOQ
Firebird Documentation IndexFirebird 3.0 Developer's GuideCreating an Application with jOOQ and Spring MVC → Start-up Code—WebInitializer