protected void customizeContext(ServletContextHandler context) throws Exception {
   File baseDirectory = new File(System.getProperty("basedir", "."));
   File overlaidScriptDirectory = new File(baseDirectory, "target/scripts");
   File mainResourcesDirectory = new File(baseDirectory, "src/main/resources");
   File testResourcesDirectory = new File(baseDirectory, "src/test/resources");
   context.setBaseResource(
       new ResourceCollection(
           new String[] {
             overlaidScriptDirectory.getCanonicalPath(),
             mainResourcesDirectory.getCanonicalPath(),
             testResourcesDirectory.getCanonicalPath()
           }));
 }
  private void startServer() throws Exception {
    jetty = new Server(0);

    final AnnotationConfigWebApplicationContext applicationContext =
        new AnnotationConfigWebApplicationContext();
    applicationContext.register(ConfigClass.class, getClass());
    applicationContext.register(configurationClasses());

    final ServletHolder servletHolder =
        new ServletHolder(new DispatcherServlet(applicationContext));
    final ServletContextHandler context = new ServletContextHandler();

    context.setErrorHandler(null); // use Spring exception handler(s)
    context.setContextPath("/");
    context.setBaseResource(Resource.newResource(new ClassPathResource("").getURI().toString()));
    context.setSessionHandler(new SessionHandler());
    context.addServlet(servletHolder, "/");

    jetty.setHandler(context);
    jetty.start();
  }