org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass Java Examples

The following examples show how to use org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ApiBootResourceLoadAutoConfiguration.java    From api-boot with Apache License 2.0 5 votes vote down vote up
/**
 * ApiBoot Jdbc Resource Pusher
 * extends from ApiBootJdbcResourcePusher
 *
 * @return ApiBootJdbcResourcePusher
 */
@Bean
@ConditionalOnMissingBean
@ConditionalOnMissingClass("org.springframework.data.redis.core.RedisTemplate")
ApiBootMemoryResourcePusher apiBootMemoryResourcePusher() {
    return new ApiBootMemoryResourcePusher(resourceStoreDelegate);
}
 
Example #2
Source File: ApiBootRateLimiterAutoConfiguration.java    From api-boot with Apache License 2.0 5 votes vote down vote up
/**
 * google guava rate limiter
 *
 * @param rateLimiterConfigCentre RateLimiter Config Centre
 * @return ApiBootRateLimiter
 */
@Bean
@ConditionalOnMissingBean
@ConditionalOnMissingClass("org.springframework.data.redis.core.RedisTemplate")
public ApiBootRateLimiter googleGuavaRateLimiter(RateLimiterConfigCentre rateLimiterConfigCentre) {
    return new GoogleGuavaRateLimiter(apiBootRateLimiterProperties.isEnableGlobalQps() ? apiBootRateLimiterProperties.getGlobalQps() : 0L, rateLimiterConfigCentre);
}
 
Example #3
Source File: ApiBootRateLimiterAutoConfiguration.java    From api-boot with Apache License 2.0 5 votes vote down vote up
/**
 * default config centre
 *
 * @return RateLimiterConfigCentre
 */
@Bean
@ConditionalOnMissingBean
@ConditionalOnMissingClass({"com.alibaba.boot.nacos.config.properties.NacosConfigProperties"})
public RateLimiterConfigCentre defaultRateLimiterConfigCentre() {
    return new DefaultRateLimiterConfigCentre();
}
 
Example #4
Source File: SpringDocConfiguration.java    From springdoc-openapi with Apache License 2.0 5 votes vote down vote up
/**
	 * Springdoc bean factory post processor 2 bean factory post processor.
	 *
	 * @return the bean factory post processor
	 */
// For spring-boot-1 compatibility
	@Bean
	@Conditional(CacheOrGroupedOpenApiCondition.class)
	@ConditionalOnMissingClass(value = BINDRESULT_CLASS)
	@Lazy(false)
	static BeanFactoryPostProcessor springdocBeanFactoryPostProcessor2() {
		return SpringdocBeanFactoryConfigurer::initBeanFactoryPostProcessor;
	}
 
Example #5
Source File: ZkAutoConfiguration.java    From zkspringboot with Apache License 2.0 5 votes vote down vote up
@Bean
@ConditionalOnMissingClass("org.zkoss.zats.mimic.Zats") //only allow custom update URI outside Zats testcases.
public ServletRegistrationBean customizableDHtmlUpdateServlet() {
	final String updateUri = zkProperties.getUpdateUri();
	logger.info("ZK-Springboot: ServletRegistrationBean for DHtmlUpdateServlet with path " + updateUri);
	return new ServletRegistrationBean(new DHtmlUpdateServlet(), updateUri + "/*");
}
 
Example #6
Source File: DiscoveryClientOptionalArgsConfiguration.java    From spring-cloud-netflix with Apache License 2.0 5 votes vote down vote up
@Bean
@ConditionalOnMissingClass("com.sun.jersey.api.client.filter.ClientFilter")
@ConditionalOnClass(
		name = "org.springframework.web.reactive.function.client.WebClient")
@ConditionalOnMissingBean(
		value = { AbstractDiscoveryClientOptionalArgs.class,
				RestTemplateDiscoveryClientOptionalArgs.class },
		search = SearchStrategy.CURRENT)
@ConditionalOnProperty(prefix = "eureka.client", name = "webclient.enabled",
		havingValue = "true")
public WebClientDiscoveryClientOptionalArgs webClientDiscoveryClientOptionalArgs() {
	logger.info("Eureka HTTP Client uses WebClient.");
	return new WebClientDiscoveryClientOptionalArgs();
}
 
Example #7
Source File: DiscoveryClientOptionalArgsConfiguration.java    From spring-cloud-netflix with Apache License 2.0 5 votes vote down vote up
@Bean
@ConditionalOnClass(name = "org.springframework.web.client.RestTemplate")
@ConditionalOnMissingClass("com.sun.jersey.api.client.filter.ClientFilter")
@ConditionalOnMissingBean(value = { AbstractDiscoveryClientOptionalArgs.class },
		search = SearchStrategy.CURRENT)
@ConditionalOnProperty(prefix = "eureka.client", name = "webclient.enabled",
		matchIfMissing = true, havingValue = "false")
public RestTemplateDiscoveryClientOptionalArgs restTemplateDiscoveryClientOptionalArgs() {
	logger.info("Eureka HTTP Client uses RestTemplate.");
	return new RestTemplateDiscoveryClientOptionalArgs();
}
 
Example #8
Source File: ShiroConfiguration.java    From spring-boot-shiro with Apache License 2.0 5 votes vote down vote up
/**
 * (基于内存的)用户授权信息Cache
 */
@Bean(name = "cacheManager")
@ConditionalOnMissingBean(name = "cacheManager")
@ConditionalOnMissingClass(value = {"org.apache.shiro.cache.ehcache.EhCacheManager"})
public CacheManager cacheManager() {
    return new MemoryConstrainedCacheManager();
}
 
Example #9
Source File: JaversMongoAutoConfiguration.java    From javers with Apache License 2.0 4 votes vote down vote up
@Bean(name = "MockAuthorProvider")
@ConditionalOnMissingBean
@ConditionalOnMissingClass({"org.springframework.security.core.context.SecurityContextHolder"})
public AuthorProvider unknownAuthorProvider() {
    return new MockAuthorProvider();
}
 
Example #10
Source File: JaversSqlAutoConfiguration.java    From javers with Apache License 2.0 4 votes vote down vote up
@Bean(name = "MockAuthorProvider")
@ConditionalOnMissingBean
@ConditionalOnMissingClass({"org.springframework.security.core.context.SecurityContextHolder"})
public AuthorProvider unknownAuthorProvider() {
    return new MockAuthorProvider();
}
 
Example #11
Source File: InternalUserModifierConfiguration.java    From cloudbreak with Apache License 2.0 4 votes vote down vote up
@Bean
@ConditionalOnMissingClass("com.sequenceiq.cloudbreak.service.user.UserService")
public InternalUserModifier internalUserModifier() {
    return new InternalUserModifier();
}
 
Example #12
Source File: MailSenderAutoConfiguration.java    From spring-cloud-aws with Apache License 2.0 4 votes vote down vote up
@Bean
@ConditionalOnMissingClass("org.springframework.cloud.aws.mail.simplemail.SimpleEmailServiceJavaMailSender")
public MailSender simpleMailSender(
		AmazonSimpleEmailService amazonSimpleEmailService) {
	return new SimpleEmailServiceMailSender(amazonSimpleEmailService);
}
 
Example #13
Source File: SleuthAnnotationAutoConfiguration.java    From spring-cloud-sleuth with Apache License 2.0 4 votes vote down vote up
@Bean
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
@ConditionalOnMissingClass("reactor.core.publisher.Flux")
SleuthMethodInvocationProcessor nonReactorSleuthMethodInvocationProcessor() {
	return new NonReactorSleuthMethodInvocationProcessor();
}
 
Example #14
Source File: RateLimitAutoConfiguration.java    From spring-cloud-zuul-ratelimit with Apache License 2.0 4 votes vote down vote up
@Bean
@ConditionalOnMissingClass("org.springframework.security.core.Authentication")
public RateLimitUtils rateLimitUtils(final RateLimitProperties rateLimitProperties) {
    return new DefaultRateLimitUtils(rateLimitProperties);
}
 
Example #15
Source File: InDBDynamicDataSourceAutoConfiguration.java    From hsweb-framework with Apache License 2.0 4 votes vote down vote up
@Bean
@ConditionalOnMissingClass("org.hswebframework.web.datasource.jta.JtaDynamicDataSourceService")
public DynamicDataSourceService inDBDynamicDataSourceService(DynamicDataSourceConfigRepository repository,
                                                             DataSource dataSource) {
    return new InDBDynamicDataSourceService(repository, new DynamicDataSourceProxy("dataSource", dataSource));
}
 
Example #16
Source File: PowerOfConditionsApplication.java    From spring-5-examples with MIT License 4 votes vote down vote up
@Bean
@ConditionalOnMissingClass("ololo.Trololo")
public String missingString2() {
  System.out.println("see me");
  return "but will see me =)";
}
 
Example #17
Source File: SofaBootRpcAutoConfiguration.java    From sofa-rpc-boot-projects with Apache License 2.0 4 votes vote down vote up
@Bean
@ConditionalOnMissingClass({ "com.alipay.sofa.healthcheck.startup.ReadinessCheckCallback" })
public ApplicationContextRefreshedListener applicationContextRefreshedListener() {
    return new ApplicationContextRefreshedListener();
}
 
Example #18
Source File: ServletRegistrationAutoConfiguration.java    From thinking-in-spring-boot-samples with Apache License 2.0 4 votes vote down vote up
@ConditionalOnMissingClass("org.springframework.boot.context.embedded.ServletRegistrationBean")
@Bean
public ServletRegistrationBean defaultServletRegistrationBean() {
    return new ServletRegistrationBean(new NoOpServlet(), "/no-op");
}
 
Example #19
Source File: FormatterAutoConfiguration.java    From thinking-in-spring-boot-samples with Apache License 2.0 4 votes vote down vote up
/**
 * 构建 {@link DefaultFormatter} Bean
 *
 * @return {@link DefaultFormatter}
 */
@Bean
@ConditionalOnMissingClass(value = "com.fasterxml.jackson.databind.ObjectMapper")
public Formatter defaultFormatter() {
    return new DefaultFormatter();
}
 
Example #20
Source File: FeignClientsConfiguration.java    From spring-cloud-openfeign with Apache License 2.0 4 votes vote down vote up
@Bean
@ConditionalOnMissingBean
@ConditionalOnMissingClass("org.springframework.data.domain.Pageable")
public Encoder feignEncoder(ObjectProvider<AbstractFormWriter> formWriterProvider) {
	return springEncoder(formWriterProvider);
}