Java 类org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication 实例源码

项目:wingtips    文件:WingtipsSpringBootConfiguration.java   
/**
 * Create and return a {@link RequestTracingFilter}, which will auto-register itself with the Spring Boot app as
 * a servlet filter and enable Wingtips tracing for incoming requests.
 *
 * @return The {@link RequestTracingFilter} that should be used.
 */
@Bean
@ConditionalOnWebApplication
public FilterRegistrationBean wingtipsRequestTracingFilter() {
    if (wingtipsProperties.isWingtipsDisabled()) {
        // We can't return null or create a FilterRegistrationBean that has a null filter inside as it will result
        //      in a NullPointerException. So instead we'll return a do-nothing servlet filter.
        return new FilterRegistrationBean(new DoNothingServletFilter());
    }

    // Allow projects to completely override the filter that gets used if desired. If not overridden then create
    //      a new one.
    if (requestTracingFilter == null) {
        requestTracingFilter = new RequestTracingFilter();
    }

    FilterRegistrationBean frb = new FilterRegistrationBean(requestTracingFilter);
    // Add the user ID header keys init param if specified in the wingtips properties.
    if (wingtipsProperties.getUserIdHeaderKeys() != null) {
        frb.addInitParameter(RequestTracingFilter.USER_ID_HEADER_KEYS_LIST_INIT_PARAM_NAME,
                             wingtipsProperties.getUserIdHeaderKeys());
    }
    // Set the order so that the tracing filter is registered first
    frb.setOrder(Ordered.HIGHEST_PRECEDENCE);
    return frb;
}
项目:tracer    文件:TracerAutoConfiguration.java   
@Bean
@ConditionalOnWebApplication
@ConditionalOnProperty(name = "tracer.filter.enabled", havingValue = "true", matchIfMissing = true)
@ConditionalOnMissingBean(name = FILTER_NAME)
public FilterRegistrationBean tracerFilter(final Tracer tracer) {
    final Filter filter = new TracerFilter(tracer);
    final FilterRegistrationBean registration = new FilterRegistrationBean(filter);
    registration.setName(FILTER_NAME);
    registration.setDispatcherTypes(REQUEST, ASYNC);
    registration.setOrder(Ordered.HIGHEST_PRECEDENCE);
    return registration;
}
项目:spring-cloud-sleuth    文件:TraceReactorAutoConfiguration.java   
@Bean
@ConditionalOnWebApplication
LastOperatorWrapper noOpLastOperatorWrapper() {
    return new LastOperatorWrapper() {
        @Override public void wrapLastOperator(Tracer tracer) {
        }
    };
}
项目:taboola-cronyx    文件:CronyxAutoConfiguration.java   
@Bean(name = "triggerRestController")
@ConditionalOnWebApplication
public MvcEndpoint triggerRestController(@Qualifier("schedulingService") SchedulingService schedulingService) {
    return new SchedulingServiceRestController(schedulingService);
}
项目:taboola-cronyx    文件:CronyxAutoConfiguration.java   
@Bean(name = "jobRestController")
@ConditionalOnWebApplication
public MvcEndpoint jobRestController(@Qualifier("defaultJobsService") JobsService jobSchedulingService) {
    return new JobServiceRestController(jobSchedulingService);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:ManagementServerPropertiesAutoConfiguration.java   
@Bean
@ConditionalOnMissingBean
@ConditionalOnWebApplication
public ServerProperties serverProperties() {
    return new ServerProperties();
}
项目:line-bot-sdk-java    文件:LineBotAutoConfiguration.java   
@Bean
@ConditionalOnWebApplication
public LineBotServerArgumentProcessor lineBotServerArgumentProcessor() {
    return new LineBotServerArgumentProcessor();
}
项目:line-bot-sdk-java    文件:LineBotAutoConfiguration.java   
@Bean
@ConditionalOnWebApplication
public LineBotServerInterceptor lineBotServerInterceptor() {
    return new LineBotServerInterceptor();
}
项目:line-bot-sdk-java    文件:LineBotAutoConfiguration.java   
@Bean
@ConditionalOnWebApplication
public LineSignatureValidator lineSignatureValidator() {
    return new LineSignatureValidator(
            lineBotProperties.getChannelSecret().getBytes(StandardCharsets.US_ASCII));
}
项目:line-bot-sdk-java    文件:LineBotAutoConfiguration.java   
@Bean
@ConditionalOnWebApplication
public LineBotCallbackRequestParser lineBotCallbackRequestParser(
        LineSignatureValidator lineSignatureValidator) {
    return new LineBotCallbackRequestParser(lineSignatureValidator);
}
项目:spring-boot-concourse    文件:ManagementServerPropertiesAutoConfiguration.java   
@Bean
@ConditionalOnMissingBean
@ConditionalOnWebApplication
public ServerProperties serverProperties() {
    return new ServerProperties();
}
项目:contestparser    文件:ManagementServerPropertiesAutoConfiguration.java   
@Bean
@ConditionalOnMissingBean
@ConditionalOnWebApplication
public ServerProperties serverProperties() {
    return new ServerProperties();
}