當前位置: 首頁>>代碼示例>>Java>>正文


Java ServletRegistrationBean.setLoadOnStartup方法代碼示例

本文整理匯總了Java中org.springframework.boot.web.servlet.ServletRegistrationBean.setLoadOnStartup方法的典型用法代碼示例。如果您正苦於以下問題:Java ServletRegistrationBean.setLoadOnStartup方法的具體用法?Java ServletRegistrationBean.setLoadOnStartup怎麽用?Java ServletRegistrationBean.setLoadOnStartup使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.springframework.boot.web.servlet.ServletRegistrationBean的用法示例。


在下文中一共展示了ServletRegistrationBean.setLoadOnStartup方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: camelServlet

import org.springframework.boot.web.servlet.ServletRegistrationBean; //導入方法依賴的package包/類
@Bean
ServletRegistrationBean camelServlet() {
    // use a @Bean to register the Camel servlet which we need to do
    // because we want to use the camel-servlet component for the Camel REST service
    ServletRegistrationBean mapping = new ServletRegistrationBean();
    mapping.setName("CamelServlet");
    mapping.setLoadOnStartup(1);
    mapping.setServlet(new CamelHttpTransportServlet());
    mapping.addUrlMappings("/camel/*");
    return mapping;
}
 
開發者ID:funktionio,項目名稱:funktion-connectors,代碼行數:12,代碼來源:FunktionRouteBuilder.java

示例2: camelServlet

import org.springframework.boot.web.servlet.ServletRegistrationBean; //導入方法依賴的package包/類
@Bean
ServletRegistrationBean camelServlet() {
    // TODO: Camel 2.19 should support this OOTB
    // use a @Bean to register the Camel servlet which we need to do
    // because we want to use the camel-servlet component for the Camel REST service
    ServletRegistrationBean mapping = new ServletRegistrationBean();
    mapping.setName("CamelServlet");
    mapping.setLoadOnStartup(1);
    // CamelHttpTransportServlet is the name of the Camel servlet to use
    mapping.setServlet(new CamelHttpTransportServlet());
    mapping.addUrlMappings("/api/*");
    return mapping;
}
 
開發者ID:abouchama,項目名稱:camel-springboot-rest-ose,代碼行數:14,代碼來源:route.java

示例3: jerseyServletRegistration

import org.springframework.boot.web.servlet.ServletRegistrationBean; //導入方法依賴的package包/類
@Bean
public ServletRegistrationBean jerseyServletRegistration(
    JerseyProperties jerseyProperties, ResourceConfig config) {

    ServletRegistrationBean registration = new ServletRegistrationBean(
        new ServletContainer(config));

    for (Map.Entry<String, String> entry : jerseyProperties.getInit().entrySet()) {
        registration.addInitParameter(entry.getKey(), entry.getValue());
    }

    registration.addUrlMappings("/" +
        (StringUtils.isEmpty(lyreProperties.getApplicationPath()) ? "api" : lyreProperties.getApplicationPath())
        + "/*");
    registration.setName(APIx.class.getName());
    registration.setLoadOnStartup(1);
    return registration;

}
 
開發者ID:groovylabs,項目名稱:lyre,代碼行數:20,代碼來源:Lyre.java

示例4: messageDispatcherServlet

import org.springframework.boot.web.servlet.ServletRegistrationBean; //導入方法依賴的package包/類
@Bean
public ServletRegistrationBean messageDispatcherServlet(
		ApplicationContext applicationContext) {
	MessageDispatcherServlet servlet = new MessageDispatcherServlet();
	servlet.setApplicationContext(applicationContext);
	String path = this.properties.getPath();
	String urlMapping = (path.endsWith("/") ? path + "*" : path + "/*");
	ServletRegistrationBean registration = new ServletRegistrationBean(servlet,
			urlMapping);
	WebServicesProperties.Servlet servletProperties = this.properties.getServlet();
	registration.setLoadOnStartup(servletProperties.getLoadOnStartup());
	for (Map.Entry<String, String> entry : servletProperties.getInit().entrySet()) {
		registration.addInitParameter(entry.getKey(), entry.getValue());
	}
	return registration;
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:17,代碼來源:WebServicesAutoConfiguration.java

示例5: keycloakJaxRsApplication

import org.springframework.boot.web.servlet.ServletRegistrationBean; //導入方法依賴的package包/類
@Bean
ServletRegistrationBean keycloakJaxRsApplication(KeycloakServerProperties keycloakServerProperties, DataSource dataSource) throws Exception {

  mockJndiEnvironment(dataSource);

  //FIXME: hack to propagate Spring Boot Properties to Keycloak Application
  EmbeddedKeycloakApplication.keycloakServerProperties = keycloakServerProperties;

  ServletRegistrationBean servlet = new ServletRegistrationBean(new HttpServlet30Dispatcher());
  servlet.addInitParameter("javax.ws.rs.Application", EmbeddedKeycloakApplication.class.getName());
  servlet.addInitParameter(ResteasyContextParameters.RESTEASY_SERVLET_MAPPING_PREFIX, keycloakServerProperties.getContextPath());
  servlet.addInitParameter(ResteasyContextParameters.RESTEASY_USE_CONTAINER_FORM_PARAMS, "true");
  servlet.addUrlMappings(keycloakServerProperties.getContextPath() + "/*");
  servlet.setLoadOnStartup(1);
  servlet.setAsyncSupported(true);

  return servlet;
}
 
開發者ID:thomasdarimont,項目名稱:spring-boot-keycloak-server-example,代碼行數:19,代碼來源:EmbeddedKeycloakConfig.java

示例6: routeServlet1

import org.springframework.boot.web.servlet.ServletRegistrationBean; //導入方法依賴的package包/類
public ServletRegistrationBean routeServlet1(RouterFunction<?> routerFunction) throws Exception {
HttpHandler httpHandler = RouterFunctions.toHttpHandler(routerFunction );
ServletHttpHandlerAdapter servlet = new ServletHttpHandlerAdapter(httpHandler);

     ServletRegistrationBean registrationBean = new ServletRegistrationBean<>(servlet, "/flux" + "/*");
     registrationBean.setLoadOnStartup(1);
     registrationBean.setAsyncSupported(true);
     
 	System.out.println("starts server");		
     return registrationBean;
 }
 
開發者ID:PacktPublishing,項目名稱:Spring-5.0-Cookbook,代碼行數:12,代碼來源:HttpServerConfig.java

示例7: servletRegistrationBean

import org.springframework.boot.web.servlet.ServletRegistrationBean; //導入方法依賴的package包/類
@Bean(name = "hystrixRegistrationBean")
public ServletRegistrationBean servletRegistrationBean() {
    ServletRegistrationBean registration = new ServletRegistrationBean(
            new HystrixMetricsStreamServlet(), "/hystrix.stream");
    registration.setName("hystrixServlet");
    registration.setLoadOnStartup(1);
    return registration;
}
 
開發者ID:rsdomingues,項目名稱:netflixmicroservices-tdc2017,代碼行數:9,代碼來源:HystrixConfig.java

示例8: oauth

import org.springframework.boot.web.servlet.ServletRegistrationBean; //導入方法依賴的package包/類
@Bean
public ServletRegistrationBean oauth() {
    DispatcherServlet dispatcherServlet = new DispatcherServlet();
    dispatcherServlet.setApplicationContext(applicationContext);
    ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(dispatcherServlet,
            "/oauth/token");
    servletRegistrationBean.setName("oauth");
    servletRegistrationBean.setLoadOnStartup(1);
    return servletRegistrationBean;
}
 
開發者ID:react-dev26,項目名稱:NGB-master,代碼行數:11,代碼來源:AppMVCConfiguration.java

示例9: springBatchSupportServlet

import org.springframework.boot.web.servlet.ServletRegistrationBean; //導入方法依賴的package包/類
@Bean
public ServletRegistrationBean springBatchSupportServlet() {

	AnnotationConfigWebApplicationContext applicationContext = new AnnotationConfigWebApplicationContext();
	applicationContext.register(SpringBatchSupportWebServletConfig.class);

	DispatcherServlet dispatcherServlet = new DispatcherServlet();
	dispatcherServlet.setApplicationContext(applicationContext);

	ServletRegistrationBean registrationBean = new ServletRegistrationBean(dispatcherServlet, getServletMapping());
	registrationBean.setName(getServletName());
	registrationBean.setLoadOnStartup(1);
	return registrationBean;
}
 
開發者ID:namics,項目名稱:spring-batch-support,代碼行數:15,代碼來源:SpringBatchSupportWebAutoConfiguration.java

示例10: configurationServlet

import org.springframework.boot.web.servlet.ServletRegistrationBean; //導入方法依賴的package包/類
@Bean
public ServletRegistrationBean configurationServlet() {

	AnnotationConfigWebApplicationContext applicationContext = new AnnotationConfigWebApplicationContext();
	applicationContext.register(ConfigServletConfig.class);

	DispatcherServlet dispatcherServlet = new DispatcherServlet();
	dispatcherServlet.setApplicationContext(applicationContext);

	ServletRegistrationBean registrationBean = new ServletRegistrationBean(dispatcherServlet, namicsConfigurationProperties.getWeb()
	                                                                                                                       .getServletMapping());
	registrationBean.setName(namicsConfigurationProperties.getWeb().getServletName());
	registrationBean.setLoadOnStartup(1);
	return registrationBean;
}
 
開發者ID:namics,項目名稱:spring-configuration-support,代碼行數:16,代碼來源:SpringConfigurationSupportWebAutoConfiguration.java

示例11: i18nSupportServlet

import org.springframework.boot.web.servlet.ServletRegistrationBean; //導入方法依賴的package包/類
@Bean
public ServletRegistrationBean i18nSupportServlet() {
	AnnotationConfigWebApplicationContext applicationContext = new AnnotationConfigWebApplicationContext();
	applicationContext.register(I18nWebConfig.class);

	DispatcherServlet dispatcherServlet = new DispatcherServlet();
	dispatcherServlet.setApplicationContext(applicationContext);

	ServletRegistrationBean registrationBean = new ServletRegistrationBean(dispatcherServlet, getServletMapping());
	registrationBean.setName(getServletName());
	registrationBean.setLoadOnStartup(1);
	return registrationBean;
}
 
開發者ID:namics,項目名稱:spring-i18n-support,代碼行數:14,代碼來源:SpringI18nSupportWebAutoConfiguration.java

示例12: dispatcherRegistration

import org.springframework.boot.web.servlet.ServletRegistrationBean; //導入方法依賴的package包/類
@Bean
public ServletRegistrationBean dispatcherRegistration(DispatcherServlet dispatcherServlet){
    ServletRegistrationBean bean =
            new ServletRegistrationBean(dispatcherServlet, "/restapi/*");
    bean.setAsyncSupported(true);
    bean.setName("catgenome");
    bean.setLoadOnStartup(1);

    return bean;
}
 
開發者ID:react-dev26,項目名稱:NGB-master,代碼行數:11,代碼來源:AppMVCConfiguration.java

示例13: servletRegistrationBean

import org.springframework.boot.web.servlet.ServletRegistrationBean; //導入方法依賴的package包/類
@Bean // for socket.io
public ServletRegistrationBean servletRegistrationBean() {
    ServletRegistrationBean bean = new ServletRegistrationBean(new AtmosphereServlet(), "/coding-ide-tty1/*");

    bean.addInitParameter("socketio-transport", "websocket");
    bean.addInitParameter("socketio-timeout", "25000");
    bean.addInitParameter("socketio-heartbeat", "15000");
    bean.addInitParameter("socketio-suspendTime", "30000");
    bean.addInitParameter("org.atmosphere.cpr.sessionSupport", "true");
    bean.addInitParameter("SPACE_HOME", spaceHome);
    bean.setLoadOnStartup(100);
    bean.setAsyncSupported(true);

    return bean;
}
 
開發者ID:Coding,項目名稱:WebIDE-Backend,代碼行數:16,代碼來源:WebSocketConfig.java

示例14: dispatcherServletRegistration

import org.springframework.boot.web.servlet.ServletRegistrationBean; //導入方法依賴的package包/類
/**
 * Register dispatcherServlet programmatically
 *
 * @return ServletRegistrationBean
 */
@Bean
public ServletRegistrationBean dispatcherServletRegistration() {

	ServletRegistrationBean registration = new ServletRegistrationBean(
		dispatcherServlet(), "/");

	registration
		.setName(DispatcherServletAutoConfiguration.DEFAULT_DISPATCHER_SERVLET_REGISTRATION_BEAN_NAME);
	registration.setAsyncSupported(true);
	registration.setEnabled(true);
	registration.setLoadOnStartup(1);

	return registration;
}
 
開發者ID:AppDirect,項目名稱:service-integration-sdk,代碼行數:20,代碼來源:AsyncServletConfiguration.java

示例15: richfacesResourcesServlet

import org.springframework.boot.web.servlet.ServletRegistrationBean; //導入方法依賴的package包/類
@Bean
public ServletRegistrationBean richfacesResourcesServlet() {
	ServletRegistrationBean result = new ServletRegistrationBean();
	result.setServlet(new ResourceServlet());
	result.setLoadOnStartup(1);
	result.addUrlMappings("/org.richfaces.resources/*");
	return result;
}
 
開發者ID:joinfaces,項目名稱:joinfaces,代碼行數:9,代碼來源:RichfacesSpringBootAutoConfiguration.java


注:本文中的org.springframework.boot.web.servlet.ServletRegistrationBean.setLoadOnStartup方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。