Java 类org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer 实例源码

项目:spring-boot-starter-purge-accesslog    文件:PurgeAccessLogAutoConfiguration.java   
/**
 * Purge access log customizer embedded servlet container customizer.
 *
 * @param serverProperties the server properties
 * @param purgeProperties  the purge properties
 * @return the embedded servlet container customizer
 */
@Bean
public EmbeddedServletContainerCustomizer purgeAccessLogCustomizer(
        final ServerProperties serverProperties,
        final PurgeProperties purgeProperties) {
    return container -> {
        final UndertowEmbeddedServletContainerFactory factory = (UndertowEmbeddedServletContainerFactory)
                container;
        final Undertow.Accesslog accesslog = serverProperties.getUndertow()
                .getAccesslog();
        final UndertowPurgeAccessLogHolder accessLogHolder = new UndertowPurgeAccessLogHolder(
                purgeProperties, accesslog.getDir().toPath(),
                accesslog.getPrefix(), accesslog.getSuffix());
        factory.addDeploymentInfoCustomizers(accessLogHolder);
    };
}
项目:spring-boot-starter-purge-accesslog    文件:PurgeAccessLogAutoConfiguration.java   
/**
 * Purge access log customizer embedded servlet container customizer.
 *
 * @param serverProperties the server properties
 * @param purgeProperties  the purge properties
 * @return the embedded servlet container customizer
 */
@Bean
public EmbeddedServletContainerCustomizer purgeAccessLogCustomizer(
        final ServerProperties serverProperties,
        final PurgeProperties purgeProperties) {
    return container -> {
        final TomcatEmbeddedServletContainerFactory factory = (TomcatEmbeddedServletContainerFactory) container;
        final Accesslog accesslog = serverProperties.getTomcat().getAccesslog();
        factory.getEngineValves().stream()
                .filter(valve -> valve instanceof AccessLogValve)
                .map(valve -> (AccessLogValve) valve).findFirst()
                .ifPresent(valve -> {
                    final TomcatPurgeAccessLogHolder accessLogHolder = new TomcatPurgeAccessLogHolder(
                            purgeProperties, Paths.get(accesslog.getDirectory()),
                            accesslog.getPrefix(), accesslog.getSuffix(), valve);
                    factory.addContextCustomizers(accessLogHolder);
                });
    };
}
项目:JavaQuarkBBS    文件:AdminApplication.java   
@Bean
public EmbeddedServletContainerCustomizer containerCustomizer() {

    return (container -> {
        ErrorPage error401Page = new ErrorPage(HttpStatus.UNAUTHORIZED, "/401.html");
        ErrorPage error404Page = new ErrorPage(HttpStatus.NOT_FOUND, "/404.html");
        ErrorPage error500Page = new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "/500.html");

        container.addErrorPages(error401Page, error404Page, error500Page);
    });
}
项目:karate    文件:TomcatConfig.java   
@Bean
public EmbeddedServletContainerCustomizer cookieProcessorCustomizer() {
    return new EmbeddedServletContainerCustomizer() {
        @Override
        public void customize(ConfigurableEmbeddedServletContainer container) {
            if (container instanceof TomcatEmbeddedServletContainerFactory) {
                TomcatEmbeddedServletContainerFactory factory = (TomcatEmbeddedServletContainerFactory) container;
                factory.addContextCustomizers(new TomcatContextCustomizer() {
                    @Override
                    public void customize(Context context) {
                        context.setCookieProcessor(new LegacyCookieProcessor());
                    }                        
                });
            }
        }

    };
}
项目:lyre    文件:Lyre.java   
@Bean
@Profile("!docker")
public EmbeddedServletContainerCustomizer embeddedServletContainerCustomizer() {
    return (container -> {

        container.setContextPath(lyreProperties.getContextPath());

        if (!lyreProperties.isEnableRemoteConnections()) {
            try {
                InetAddress inetAddress = InetAddress.getByAddress(new byte[]{127, 0, 0, 1});
                container.setAddress(inetAddress);
            } catch (UnknownHostException e) {
                //supressed exception
            }
        }

        container.setPort(lyreProperties.getPort());
    });
}
项目:lyre    文件:DockerConfiguration.java   
@Bean
public EmbeddedServletContainerCustomizer embeddedServletContainerTest() {
    return (container -> {

        lyreProperties.setPort(8080);

        container.setContextPath(lyreProperties.getContextPath());

        if (!lyreProperties.isEnableRemoteConnections()) {
            try {
                InetAddress inetAddress = InetAddress.getByAddress(new byte[]{127, 0, 0, 1});
                container.setAddress(inetAddress);
            } catch (UnknownHostException e) {
                //supressed exception
            }
        }

        container.setPort(lyreProperties.getPort());
    });
}
项目:tinker-manager    文件:WebAppConfig.java   
@Bean
    public EmbeddedServletContainerCustomizer containerCustomizer() {
        return new EmbeddedServletContainerCustomizer() {
            @Override
            public void customize(ConfigurableEmbeddedServletContainer container) {
                ErrorPage page404 = new ErrorPage(HttpStatus.NOT_FOUND,"/404");
                container.addErrorPages(page404);
            }
        };
//        return (container -> {
//            ErrorPage error401Page = new ErrorPage(HttpStatus.UNAUTHORIZED, "/401.html");
//            ErrorPage error404Page = new ErrorPage(HttpStatus.NOT_FOUND, "/404.html");
//            ErrorPage error500Page = new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "/500.html");
//
//            container.addErrorPages(error401Page, error404Page, error500Page);
//        });
    }
项目:various_demos    文件:Application.java   
@Bean
public EmbeddedServletContainerCustomizer embeddedServletContainerCustomizer() {
    return new EmbeddedServletContainerCustomizer() {
        @Override
        public void customize(ConfigurableEmbeddedServletContainer container) {
            if (container instanceof TomcatEmbeddedServletContainerFactory) {
                TomcatEmbeddedServletContainerFactory tomcatEmbeddedServletContainerFactory = (TomcatEmbeddedServletContainerFactory) container;


                RedisSessionHandlerValve valve = new RedisSessionHandlerValve();
                List<RedisSessionHandlerValve> valves = 
                        new ArrayList<RedisSessionHandlerValve>();
                valves.add(0, valve);
                tomcatEmbeddedServletContainerFactory.setContextValves(valves);
                tomcatEmbeddedServletContainerFactory.setPort(28080);    // Set the port of embeded tomcat as 28080 for default. 

                System.out.println("Enterring EmbeddedServletContainerCustomizer.customize()...");
                tomcatEmbeddedServletContainerFactory.addContextCustomizers(
                        new ServletContainerCustomizer());
            }
        }
    };
}
项目:various_demos    文件:EmbeddedTomcatConfig.java   
@Bean
public EmbeddedServletContainerCustomizer embeddedServletContainerCustomizer() {
    return new EmbeddedServletContainerCustomizer() {
        @Value("${application.port}")
        private int embeddedServletContainerListenPort;

        @Override
        public void customize(ConfigurableEmbeddedServletContainer container) {
            if (container instanceof TomcatEmbeddedServletContainerFactory) {
                TomcatEmbeddedServletContainerFactory tomcatEmbeddedServletContainerFactory = 
                        (TomcatEmbeddedServletContainerFactory) container;
                if (embeddedServletContainerListenPort <= 1024 ||  embeddedServletContainerListenPort > 65535) {
                    throw new IllegalArgumentException("The value of \"application.port\" in the properties file is invalid.");
                }

                tomcatEmbeddedServletContainerFactory.setPort(embeddedServletContainerListenPort);
            }
        }
    };
}
项目:metasfresh-webui-api    文件:WebRestApiApplication.java   
@Bean
public EmbeddedServletContainerCustomizer servletContainerCustomizer()
{
    return new EmbeddedServletContainerCustomizer()
    {
        @Override
        public void customize(final ConfigurableEmbeddedServletContainer servletContainer)
        {
            final TomcatEmbeddedServletContainerFactory tomcatContainerFactory = (TomcatEmbeddedServletContainerFactory)servletContainer;
            tomcatContainerFactory.addConnectorCustomizers(new TomcatConnectorCustomizer()
            {
                @Override
                public void customize(final Connector connector)
                {
                    final AbstractHttp11Protocol<?> httpProtocol = (AbstractHttp11Protocol<?>)connector.getProtocolHandler();
                    httpProtocol.setCompression("on");
                    httpProtocol.setCompressionMinSize(256);
                    final String mimeTypes = httpProtocol.getCompressibleMimeType();
                    final String mimeTypesWithJson = mimeTypes + "," + MediaType.APPLICATION_JSON_VALUE + ",application/javascript";
                    httpProtocol.setCompressibleMimeType(mimeTypesWithJson);
                }
            });
        }
    };
}
项目:Robocode    文件:AppConfig.java   
@Bean
@Autowired
public EmbeddedServletContainerCustomizer servletContainerCustomizer(ServerProperties properties) {
    return container -> {
        if (container instanceof JettyEmbeddedServletContainerFactory) {
            JettyEmbeddedServletContainerFactory jettyContainer = (JettyEmbeddedServletContainerFactory) container;
            jettyContainer.addConfigurations(new AbstractConfiguration() {

                @Override
                public void configure(WebAppContext context) throws Exception {
                    properties.getContextParameters().forEach((k, v) -> context.setInitParameter(k, v));
                }
            });
        }
    };
}
项目:findlunch    文件:Beans.java   
/**
 * Container customizer. Configures the embedded tomcat (e.g. post size)
 *
 * @return the embedded servlet container customizer
 * @throws Exception the exception
 */
@Bean 
public EmbeddedServletContainerCustomizer containerCustomizer(
        ) throws Exception {


      return new EmbeddedServletContainerCustomizer() {
        @Override
        public void customize(ConfigurableEmbeddedServletContainer container) {

              if (container instanceof TomcatEmbeddedServletContainerFactory) {

                  TomcatEmbeddedServletContainerFactory tomcat = (TomcatEmbeddedServletContainerFactory) container;
                  tomcat.addConnectorCustomizers(
                          new TomcatConnectorCustomizer() {
                            @Override
                            public void customize(Connector connector) {
                                  connector.setMaxPostSize(20000000);//20MB
                              }
                        }
                  );
              }
          }
    };
  }
项目:citizenship-appointment-server    文件:AppConfig.java   
@Bean
public EmbeddedServletContainerCustomizer disableServerHeader() {
    return container -> {
        if (container instanceof JettyEmbeddedServletContainerFactory) {
            ((JettyEmbeddedServletContainerFactory) container).addServerCustomizers(new JettyServerCustomizer() {
                @Override
                public void customize(Server server) {
                    for (Connector connector : server.getConnectors()) {
                        if (connector instanceof ServerConnector) {
                            HttpConnectionFactory connectionFactory = connector.getConnectionFactory(HttpConnectionFactory.class);
                            connectionFactory.getHttpConfiguration().setSendServerVersion(false);
                        }
                    }
                }
            });
        }
    };
}
项目:portal-de-servicos    文件:ServletContainerConfig.java   
@Bean
public EmbeddedServletContainerCustomizer servletContainerCustomizer() {
    return servletContainer -> {
        addMimeMappingsForFonts(servletContainer);

        TomcatEmbeddedServletContainerFactory container = (TomcatEmbeddedServletContainerFactory) servletContainer;

        container.setRegisterJspServlet(false);

        container.addContextCustomizers(customizer -> customizer.addWelcomeFile("index.html"));
        container.addConnectorCustomizers(
                connector -> {
                    AbstractHttp11Protocol httpProtocol = (AbstractHttp11Protocol) connector.getProtocolHandler();
                    httpProtocol.setCompression("on");
                    httpProtocol.setCompressionMinSize(256);
                    httpProtocol.setCompressableMimeTypes(COMPRESSIBLE_MEDIA_TYPES);
                }
        );
    };
}
项目:recaptcha-spring-boot-starter    文件:TestApplication.java   
@Bean
public EmbeddedServletContainerCustomizer customizer() {
    return new EmbeddedServletContainerCustomizer() {

        @Override
        public void customize(ConfigurableEmbeddedServletContainer container) {
            TomcatEmbeddedServletContainerFactory tomcat = (TomcatEmbeddedServletContainerFactory) container;
            TomcatContextCustomizer contextCustomizer = new TomcatContextCustomizer() {

                @Override
                public void customize(Context context) {
                    context.setCookieProcessor(new LegacyCookieProcessor());
                }
            };
            tomcat.addContextCustomizers(contextCustomizer);
        }
    };
}
项目:centromere    文件:WebServicesConfig.java   
@Bean
public EmbeddedServletContainerCustomizer servletContainerCustomizer(){
    return configurableEmbeddedServletContainer -> 
            ((TomcatEmbeddedServletContainerFactory) configurableEmbeddedServletContainer).addConnectorCustomizers(
            new TomcatConnectorCustomizer() {
                @Override
                public void customize(Connector connector) {
                    AbstractHttp11Protocol httpProtocol = (AbstractHttp11Protocol) connector.getProtocolHandler();
                    httpProtocol.setCompression("on");
                    httpProtocol.setCompressionMinSize(256);
                    String mimeTypes = httpProtocol.getCompressableMimeTypes();
                    String mimeTypesWithJson = mimeTypes + "," + MediaType.APPLICATION_JSON_VALUE;
                    httpProtocol.setCompressableMimeTypes(mimeTypesWithJson);
                }
            }
    );
}
项目:editor-de-servicos    文件:ServletContainerConfig.java   
@Bean
public EmbeddedServletContainerCustomizer servletContainerCustomizer() {
    return servletContainer -> {
        addMimeMappingsForFonts(servletContainer);

        TomcatEmbeddedServletContainerFactory container = (TomcatEmbeddedServletContainerFactory) servletContainer;

        container.setRegisterJspServlet(false);

        container.addContextCustomizers(customizer -> customizer.addWelcomeFile("index.html"));
        container.addConnectorCustomizers(
                connector -> {
                    AbstractHttp11Protocol httpProtocol = (AbstractHttp11Protocol) connector.getProtocolHandler();
                    httpProtocol.setCompression("on");
                    httpProtocol.setCompressionMinSize(256);
                    httpProtocol.setCompressableMimeTypes(COMPRESSIBLE_MEDIA_TYPES);
                }
        );
    };
}
项目:booties    文件:ProxiesAutoConfiguration.java   
@Bean
public EmbeddedServletContainerCustomizer embeddedServletContainerCustomizer() {

    return new EmbeddedServletContainerCustomizer() {

        @Override
        public void customize(final ConfigurableEmbeddedServletContainer container) {
            if (container instanceof TomcatEmbeddedServletContainerFactory) {
                TomcatEmbeddedServletContainerFactory tomcat = (TomcatEmbeddedServletContainerFactory) container;
                for (TomcatConnectorCustomizer customizer : tomcatConnectorCustomizers) {
                    tomcat.addConnectorCustomizers(customizer);
                }
            }
        }
    };
}
项目:spring-boot-spring-loaded-java8-example    文件:Application.java   
@Bean
public EmbeddedServletContainerCustomizer containerCustomizer() {
    return factory -> {
        TomcatEmbeddedServletContainerFactory containerFactory = (TomcatEmbeddedServletContainerFactory) factory;
        containerFactory.setTomcatContextCustomizers(Arrays.asList(context -> {
            final PersistentManager persistentManager = new PersistentManager();
            final FileStore store = new FileStore();

            final String sessionDirectory = makeSessionDirectory();
            log.info("Writing sessions to " + sessionDirectory);
            store.setDirectory(sessionDirectory);

            persistentManager.setStore(store);
            context.setManager(persistentManager);
        }));
    };
}
项目:ozwillo-portal    文件:OasisWebConfiguration.java   
@Bean
public EmbeddedServletContainerCustomizer containerCustomizer() {
    if (highAvailability) {
        logger.info("Setting up high availability configuration");
        return factory -> {
            logger.info("Customizing Tomcat container");

            TomcatEmbeddedServletContainerFactory containerFactory = (TomcatEmbeddedServletContainerFactory) factory;
            TomcatContextCustomizer tomcatContextCustomizer = context -> {
                context.setSessionTimeout(30);
                context.setManager(new MemcachedBackupSessionManager() {{
                    setMemcachedNodes(nodes);
                    setFailoverNodes(failover);
                    setRequestUriIgnorePattern(".*\\.(ico|png|gif|jpg|css|js)$");
                }});
            };
            containerFactory.setTomcatContextCustomizers(Collections.singletonList(tomcatContextCustomizer));

            setMimeMappings(factory);
        };
    } else {
        logger.info("Skipping HA configuration");
        return this::setMimeMappings;
    }
}
项目:pyblog    文件:WebConfig.java   
@Bean
public EmbeddedServletContainerCustomizer containerCustomizer() {

  return new EmbeddedServletContainerCustomizer() {
    @Override
    public void customize(ConfigurableEmbeddedServletContainer container) {
      ErrorPage error404Page = new ErrorPage(HttpStatus.NOT_FOUND, "/404.html");
      container.addErrorPages(error404Page);
    }
  };
}
项目:eagle-oj-api    文件:WebApplication.java   
@Bean
public EmbeddedServletContainerCustomizer containerCustomizer() {
    return container -> {
        container.addErrorPages(
                new ErrorPage(HttpStatus.NOT_FOUND, "/404")
        );
    };
}
项目:fiery    文件:RagnarApplication.java   
@Bean
EmbeddedServletContainerCustomizer containerCustomizer() throws Exception {
    return (ConfigurableEmbeddedServletContainer container) -> {
        if (container instanceof TomcatEmbeddedServletContainerFactory) {
            TomcatEmbeddedServletContainerFactory tomcat = (TomcatEmbeddedServletContainerFactory) container;
            tomcat.addConnectorCustomizers(
                    (connector) -> {
                        connector.setMaxPostSize(1000000000); // 1000 MB
                    }
            );
        }
    };
}
项目:OSPicture    文件:ErrorPages.java   
@Bean
public EmbeddedServletContainerCustomizer containerCustomizer() {
    return (container -> {
        ErrorPage error404Page = new ErrorPage(HttpStatus.NOT_FOUND, "/404.html");

        container.addErrorPages(error404Page);
    });
}
项目:uckefu    文件:Application.java   
@Bean
public EmbeddedServletContainerCustomizer containerCustomizer() {

    return new EmbeddedServletContainerCustomizer() {
        @Override
        public void customize(ConfigurableEmbeddedServletContainer container) {

            ErrorPage error = new ErrorPage("/error.html");

            container.addErrorPages(error);
        }
    };
}
项目:uroborosql-springboot-demo    文件:AppConfig.java   
@Bean
public EmbeddedServletContainerCustomizer containerCustomizer() {
    return (container -> {
        ErrorPage error404Page = new ErrorPage(HttpStatus.NOT_FOUND, "/");
        container.addErrorPages(error404Page);
    });
}
项目:easyweb    文件:WebConfig.java   
@Bean
public EmbeddedServletContainerCustomizer containerCustomizer() {

    return new EmbeddedServletContainerCustomizer() {
        @Override
        public void customize(ConfigurableEmbeddedServletContainer container) {
            ErrorPage error404Page = new ErrorPage(HttpStatus.NOT_FOUND, "/404");
            ErrorPage error500Page = new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "/500");
            container.addErrorPages(error404Page);
            container.addErrorPages(error500Page);
        }
    };
}
项目:jeeWe    文件:ErrorPageConfiguration.java   
@Bean
public EmbeddedServletContainerCustomizer containerCustomizer() {

    return (container -> {
        ErrorPage error401Page = new ErrorPage(HttpStatus.UNAUTHORIZED, "/401.html");
        ErrorPage error404Page = new ErrorPage(HttpStatus.NOT_FOUND, "/404.html");
        ErrorPage error500Page = new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "/500.html");
        container.addErrorPages(error401Page, error404Page, error500Page);
    });
}
项目:seldon-core    文件:App.java   
@Bean
public EmbeddedServletContainerCustomizer tomcatCustomizer() {
    return new EmbeddedServletContainerCustomizer() {

        @Override
        public void customize(ConfigurableEmbeddedServletContainer container) {
            if (container instanceof TomcatEmbeddedServletContainerFactory) {
                ((TomcatEmbeddedServletContainerFactory) container)
                        .addConnectorCustomizers(gracefulShutdown());
            }

        }
    };
}
项目:seldon-core    文件:App.java   
@Bean
public EmbeddedServletContainerCustomizer tomcatCustomizer() {
    return new EmbeddedServletContainerCustomizer() {

        @Override
        public void customize(ConfigurableEmbeddedServletContainer container) {
            if (container instanceof TomcatEmbeddedServletContainerFactory) {
                ((TomcatEmbeddedServletContainerFactory) container)
                        .addConnectorCustomizers(gracefulShutdown());
            }

        }
    };
}
项目:spring-vue-demo    文件:SpringVueDemoApplication.java   
@Bean
public EmbeddedServletContainerCustomizer containerCustomizer() {

    return (container -> {
        ErrorPage error404Page = new ErrorPage(HttpStatus.NOT_FOUND, "/404.html");

        container.addErrorPages(error404Page);
    });
}
项目:NGB-master    文件:AppMVCConfiguration.java   
@Bean
@ConditionalOnClass({EmbeddedServletContainerFactory.class })
public EmbeddedServletContainerCustomizer tomcatContainerCustomizer() {
    return container -> {
        TomcatEmbeddedServletContainerFactory tomcat = (TomcatEmbeddedServletContainerFactory) container;
        tomcat.setTldSkip("*.jar");

    };
}
项目:ipst    文件:WebConfig.java   
@Bean
public EmbeddedServletContainerCustomizer containerCustomizer() {
    return container -> {
        if (config.getServer().getHost() != null) {
            try {
                container.setAddress(InetAddress.getByName(config.getServer().getHost()));
            } catch (UnknownHostException e) {
                e.printStackTrace();
                throw new RuntimeException(e);
            }
        }
        container.setPort(config.getServer().getPort());
        container.setSsl(config.getSsl());
    };
}
项目:SSMSeedProject    文件:WebMvcConfig.java   
/**
 * 自定义异常页
 */
@Bean
public EmbeddedServletContainerCustomizer containerCustomizer() {
    return (container -> {
        ErrorPage error403Page = new ErrorPage(HttpStatus.FORBIDDEN, "/403");
        ErrorPage error404Page = new ErrorPage(HttpStatus.NOT_FOUND, "/404");
        ErrorPage error500Page = new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "/500");
        container.addErrorPages(error403Page, error404Page, error500Page);
    });
}
项目:ethereum-secure-proxy    文件:Application.java   
@Bean
public EmbeddedServletContainerCustomizer containerCustomizer() {
    return new EmbeddedServletContainerCustomizer() {
        @Override
        public void customize(ConfigurableEmbeddedServletContainer container) {
            container.setPort(cmdLineResult.getPort());
        }
    };
}
项目:MBLive    文件:WebConfig.java   
@Bean
public EmbeddedServletContainerCustomizer containerCustomizer() {
    return new EmbeddedServletContainerCustomizer() {
        @Override
        public void customize(ConfigurableEmbeddedServletContainer container) {
            ErrorPage error404Page = new ErrorPage(HttpStatus.NOT_FOUND, "/pageNotFound");
            container.addErrorPages(error404Page);
        }
    };
}
项目:interview-preparation    文件:DispatchServletConfig.java   
@Bean
public EmbeddedServletContainerCustomizer embeddedServletContainerCustomizer() {
    return new EmbeddedServletContainerCustomizer() {

        @Override
        public void customize(ConfigurableEmbeddedServletContainer container) {

            System.err.println("Customizing embeddedServlet container ");
            container.setSessionTimeout(1, TimeUnit.SECONDS);
            container.setPort(8084);// on which port embedded tomcat should run
            container.setContextPath("/spring-web-practice");// This is to make in sync with direct TOMCAT deployment and embedded server deployment
        }
    };
}
项目:react-practice-web    文件:Launcher.java   
@Bean
public EmbeddedServletContainerCustomizer containerCustomizer() {
    return container -> {
        container.addErrorPages(new ErrorPage(HttpStatus.NOT_FOUND, "/404.html"));
        container.addErrorPages(new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "/error.html"));
    };
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:ServerPropertiesAutoConfigurationTests.java   
@Bean
public EmbeddedServletContainerCustomizer containerCustomizer() {
    return new EmbeddedServletContainerCustomizer() {

        @Override
        public void customize(ConfigurableEmbeddedServletContainer container) {
            container.setPort(3000);
        }

    };
}
项目:castlemock    文件:ErrorComponent.java   
@Bean
public EmbeddedServletContainerCustomizer containerCustomizer() {

    return new EmbeddedServletContainerCustomizer() {
        @Override
        public void customize(ConfigurableEmbeddedServletContainer container) {
            ErrorPage error404Page = new ErrorPage(HttpStatus.NOT_FOUND, "/web/error/404");

            container.addErrorPages(error404Page);
        }
    };
}