当前位置: 首页>>代码示例>>Java>>正文


Java Conditional类代码示例

本文整理汇总了Java中org.springframework.context.annotation.Conditional的典型用法代码示例。如果您正苦于以下问题:Java Conditional类的具体用法?Java Conditional怎么用?Java Conditional使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Conditional类属于org.springframework.context.annotation包,在下文中一共展示了Conditional类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: appengineCloudSqlJdbcInfoProvider

import org.springframework.context.annotation.Conditional; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean(CloudSqlJdbcInfoProvider.class)
@Conditional(AppEngineCondition.class)
public CloudSqlJdbcInfoProvider appengineCloudSqlJdbcInfoProvider() {
	CloudSqlJdbcInfoProvider appEngineProvider = new AppEngineCloudSqlJdbcInfoProvider(this.gcpCloudSqlProperties);

	if (LOGGER.isInfoEnabled()) {
		LOGGER.info("App Engine JdbcUrl provider. Connecting to "
				+ appEngineProvider.getJdbcUrl() + " with driver "
				+ appEngineProvider.getJdbcDriverClass());
	}

	setCredentialsProperty();

	return appEngineProvider;
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-gcp,代码行数:17,代码来源:GcpCloudSqlAutoConfiguration.java

示例2: matches

import org.springframework.context.annotation.Conditional; //导入依赖的package包/类
public static boolean matches(ConditionContext context) {
	Class<AuthorizationServerEndpointsConfigurationBeanCondition> type = AuthorizationServerEndpointsConfigurationBeanCondition.class;
	Conditional conditional = AnnotationUtils.findAnnotation(type,
			Conditional.class);
	StandardAnnotationMetadata metadata = new StandardAnnotationMetadata(type);
	for (Class<? extends Condition> conditionType : conditional.value()) {
		Condition condition = BeanUtils.instantiateClass(conditionType);
		if (condition.matches(context, metadata)) {
			return true;
		}
	}
	return false;
}
 
开发者ID:spring-projects,项目名称:spring-security-oauth2-boot,代码行数:14,代码来源:OAuth2ResourceServerConfiguration.java

示例3: clientFactory

import org.springframework.context.annotation.Conditional; //导入依赖的package包/类
/**
 * Returns {@link ClientFactory#DEFAULT} which is used as the default {@link ClientFactory} of a
 * {@link CentralDogma} client.
 */
@Bean
@ForCentralDogma
@Conditional(MissingCentralDogmaClientFactory.class)
public ClientFactory clientFactory() {
    return ClientFactory.DEFAULT;
}
 
开发者ID:line,项目名称:centraldogma,代码行数:11,代码来源:CentralDogmaConfiguration.java

示例4: webMvcConfigurer

import org.springframework.context.annotation.Conditional; //导入依赖的package包/类
@Bean
@Conditional(Development.class)
public WebMvcConfigurer webMvcConfigurer() {
    return new WebMvcConfigurerAdapter() {
        @Override
        public void addCorsMappings(final CorsRegistry registry) {
            registry.addMapping("/**");
        }
    };
}
 
开发者ID:backpaper0,项目名称:spring-boot-vue-simple-sample,代码行数:11,代码来源:DemoApplication.java

示例5: dataSource

import org.springframework.context.annotation.Conditional; //导入依赖的package包/类
@Bean
@Conditional(PostgreSqlUrlCondition.class)
public DataSource dataSource(Environment env) throws URISyntaxException {
  final String DATABASE_URL = env.getProperty("DATABASE_URL");

  return createHerokuDataSource(DATABASE_URL);
}
 
开发者ID:VisualDataWeb,项目名称:OntoBench,代码行数:8,代码来源:PersistenceConfig.java

示例6: getConditionClasses

import org.springframework.context.annotation.Conditional; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private List<String[]> getConditionClasses(AnnotatedTypeMetadata metadata) {
	MultiValueMap<String, Object> attributes = metadata
			.getAllAnnotationAttributes(Conditional.class.getName(), true);
	Object values = (attributes != null ? attributes.get("value") : null);
	return (List<String[]>) (values != null ? values : Collections.emptyList());
}
 
开发者ID:lodsve,项目名称:lodsve-framework,代码行数:8,代码来源:AbstractNestedCondition.java

示例7: userService

import org.springframework.context.annotation.Conditional; //导入依赖的package包/类
/**
 * The @Bean annotation tells Spring that this method will return an object that should <br>
 * be registered as a bean in the Spring application context.
 *
 * @return userService
 */
@Bean
@Conditional(UserCondition.class)
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public UserService userService() {
    logger.debug("userService");
    return new UserServiceImpl();
}
 
开发者ID:tvajjala,项目名称:interview-preparation,代码行数:14,代码来源:Application.java

示例8: clientBuilder

import org.springframework.context.annotation.Conditional; //导入依赖的package包/类
/**
 * When the domain variable is set, we lookup the elasticsearch domain url dynamically, using the
 * AWS api. Otherwise, we assume the URL specified in ES_HOSTS is correct.
 */
@Bean
@Conditional(AwsDomainSetCondition.class)
InternalElasticsearchClient.Builder clientBuilder(
    ZipkinElasticsearchStorageProperties es,
    ZipkinElasticsearchAwsStorageProperties aws,
    @Qualifier("zipkinElasticsearchHttp") OkHttpClient client) {
  String domain = aws.getDomain();
  String region = region(es, aws);

  ElasticsearchDomainEndpoint hosts = new ElasticsearchDomainEndpoint(
      client, HttpUrl.parse("https://es." + region + ".amazonaws.com"), domain);

  return HttpClientBuilder.create(client).hosts(hosts);
}
 
开发者ID:liaominghua,项目名称:zipkin,代码行数:19,代码来源:ZipkinElasticsearchAwsStorageAutoConfiguration.java

示例9: securityTokenService

import org.springframework.context.annotation.Conditional; //导入依赖的package包/类
/** Setup {@link AWSSecurityTokenService} client an IAM role to assume is given. */
@Bean
@ConditionalOnMissingBean
@Conditional(STSSetCondition.class)
AWSSecurityTokenService securityTokenService(ZipkinSQSCollectorProperties properties) {
  return AWSSecurityTokenServiceClientBuilder.standard()
      .withCredentials(getDefaultCredentialsProvider(properties))
      .withRegion(properties.awsStsRegion)
      .build();
}
 
开发者ID:openzipkin,项目名称:zipkin-aws,代码行数:11,代码来源:ZipkinSQSCredentialsAutoConfiguration.java

示例10: securityTokenService

import org.springframework.context.annotation.Conditional; //导入依赖的package包/类
/** Setup {@link AWSSecurityTokenService} client an IAM role to assume is given. */
@Bean
@ConditionalOnMissingBean
@Conditional(STSSetCondition.class)
AWSSecurityTokenService securityTokenService(ZipkinKinesisCollectorProperties properties) {
  return AWSSecurityTokenServiceClientBuilder.standard()
      .withCredentials(getDefaultCredentialsProvider(properties))
      .withRegion(properties.awsStsRegion)
      .build();
}
 
开发者ID:openzipkin,项目名称:zipkin-aws,代码行数:11,代码来源:ZipkinKinesisCredentialsAutoConfiguration.java

示例11: restServer

import org.springframework.context.annotation.Conditional; //导入依赖的package包/类
/**
 * REST server for listening to POST/GET requests
 * @return
 */
@Bean
@Conditional(RestEnabledCondition.class)
public Serveable restServer()
{
  return new WebbitRestServerBean(port, nThreads, basePkg);
  
}
 
开发者ID:javanotes,项目名称:reactive-data,代码行数:12,代码来源:Configurator.java

示例12: asyncRestProcessor

import org.springframework.context.annotation.Conditional; //导入依赖的package包/类
/**
 * Asynchronous REST processor
 * @return
 */
@Bean
@Conditional(RestEnabledCondition.class)
public AsyncEventReceiverBean asyncRestProcessor()
{
  return new AsyncEventReceiverBean();
}
 
开发者ID:javanotes,项目名称:reactive-data,代码行数:11,代码来源:Configurator.java

示例13: dllLoader

import org.springframework.context.annotation.Conditional; //导入依赖的package包/类
/**
 * Jar module loader.
 * @return
 */
@Bean
@Conditional(RestEnabledCondition.class)
public JarModuleLoader dllLoader()
{
  try 
  {
    if(StringUtils.isEmpty(dllRoot))
      throw new BeanCreationException("'restserver.jaxrs.extDir' path not found");
    File f = ResourceLoaderHelper.loadFromFileOrClassPath(dllRoot, false);
    return new JarModuleLoader(f);
  } catch (IOException e) {
    throw new BeanCreationException("'restserver.jaxrs.extDir' path not found", e);
  }
}
 
开发者ID:javanotes,项目名称:reactive-data,代码行数:19,代码来源:Configurator.java

示例14: jarSharingAgent

import org.springframework.context.annotation.Conditional; //导入依赖的package包/类
/**
 * Jar distribution agent.
 * @return
 */
@Bean
@Conditional(RestEnabledCondition.class)
public JarFileSharingAgent jarSharingAgent()
{
  return new JarFileSharingAgent();
}
 
开发者ID:javanotes,项目名称:reactive-data,代码行数:11,代码来源:Configurator.java

示例15: periodicTrigger

import org.springframework.context.annotation.Conditional; //导入依赖的package包/类
@Bean(name = TriggerConstants.TRIGGER_BEAN_NAME)
@Conditional(PeriodicTriggerCondition.class)
public Trigger periodicTrigger() {
	PeriodicTrigger trigger = new PeriodicTrigger(triggerProperties.getFixedDelay(),
			triggerProperties.getTimeUnit());
	trigger.setInitialDelay(triggerProperties.getInitialDelay());
	return trigger;
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-stream-app-starters,代码行数:9,代码来源:TriggerConfiguration.java


注:本文中的org.springframework.context.annotation.Conditional类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。