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


Java ConditionalOnMissingBean类代码示例

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


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

示例1: jdbcMessageSourceDa

import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; //导入依赖的package包/类
@Bean(name = "jdbcMessageSourceDao")
@ConditionalOnMissingBean
public SimpleJdbcMessageSourceDao jdbcMessageSourceDa(DataSource dataSource) {
	SimpleJdbcMessageSourceDao jdbcMessageSourceDao = new SimpleJdbcMessageSourceDao();
	jdbcMessageSourceDao.setDataSource(dataSource);
	if (hasText(getTableName())) {
		jdbcMessageSourceDao.setTable(getTableName());
	}
	if (hasText(getMessageColumnName())) {
		jdbcMessageSourceDao.setMessage(getMessageColumnName());
	}
	if (hasText(getTypeColumnName())) {
		jdbcMessageSourceDao.setType(getTypeColumnName());
	}
	if (hasText(getCodeIdColumnName())) {
		jdbcMessageSourceDao.setCodeId(getCodeIdColumnName());
	}
	if (hasText(getLangIdColumnName())) {
		jdbcMessageSourceDao.setLangId(getLangIdColumnName());
	}
	return jdbcMessageSourceDao;
}
 
开发者ID:namics,项目名称:spring-i18n-support,代码行数:23,代码来源:SpringI18nSupportAutoConfiguration.java

示例2: userInfoTokenServices

import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean({ ConnectionFactoryLocator.class,
		ResourceServerTokenServices.class })
public UserInfoTokenServices userInfoTokenServices() {
	UserInfoTokenServices services = new UserInfoTokenServices(
			this.sso.getUserInfoUri(), this.sso.getClientId());
	services.setTokenType(this.sso.getTokenType());
	services.setRestTemplate(this.restTemplate);
	if (this.authoritiesExtractor != null) {
		services.setAuthoritiesExtractor(this.authoritiesExtractor);
	}
	if (this.principalExtractor != null) {
		services.setPrincipalExtractor(this.principalExtractor);
	}
	return services;
}
 
开发者ID:spring-projects,项目名称:spring-security-oauth2-boot,代码行数:17,代码来源:ResourceServerTokenServicesConfiguration.java

示例3: proxyValidateController

import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; //导入依赖的package包/类
@Autowired
@Bean
@ConditionalOnMissingBean(name = "proxyValidateController")
public ProxyValidateController proxyValidateController(@Qualifier("argumentExtractor") final ArgumentExtractor argumentExtractor,
                                                       @Qualifier("defaultAuthenticationSystemSupport")
                                                       final AuthenticationSystemSupport authenticationSystemSupport) {
    final ProxyValidateController c = new ProxyValidateController();
    c.setValidationSpecification(cas20ProtocolValidationSpecification);
    c.setSuccessView(cas3ServiceSuccessView());
    c.setFailureView(cas3ServiceFailureView);
    c.setProxyHandler(proxy20Handler);
    c.setAuthenticationSystemSupport(authenticationSystemSupport);
    c.setServicesManager(servicesManager);
    c.setCentralAuthenticationService(centralAuthenticationService);
    c.setArgumentExtractor(argumentExtractor);
    c.setMultifactorTriggerSelectionStrategy(multifactorTriggerSelectionStrategy);
    c.setAuthenticationContextValidator(authenticationContextValidator);
    c.setJsonView(cas3ServiceJsonView());
    c.setAuthnContextAttribute(casProperties.getAuthn().getMfa().getAuthenticationContextAttribute());
    return c;
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:22,代码来源:CasValidationConfiguration.java

示例4: mqProducer

import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; //导入依赖的package包/类
@Bean
@ConditionalOnClass(DefaultMQProducer.class)
@ConditionalOnMissingBean(DefaultMQProducer.class)
@ConditionalOnProperty(prefix = "spring.rocketmq", value = {"nameServer", "producer.group"})
public DefaultMQProducer mqProducer(RocketMQProperties rocketMQProperties) {

    RocketMQProperties.Producer producerConfig = rocketMQProperties.getProducer();
    String groupName = producerConfig.getGroup();
    Assert.hasText(groupName, "[spring.rocketmq.producer.group] must not be null");

    DefaultMQProducer producer = new DefaultMQProducer(producerConfig.getGroup());
    producer.setNamesrvAddr(rocketMQProperties.getNameServer());
    producer.setSendMsgTimeout(producerConfig.getSendMsgTimeout());
    producer.setRetryTimesWhenSendFailed(producerConfig.getRetryTimesWhenSendFailed());
    producer.setRetryTimesWhenSendAsyncFailed(producerConfig.getRetryTimesWhenSendAsyncFailed());
    producer.setMaxMessageSize(producerConfig.getMaxMessageSize());
    producer.setCompressMsgBodyOverHowmuch(producerConfig.getCompressMsgBodyOverHowmuch());
    producer.setRetryAnotherBrokerWhenNotStoreOK(producerConfig.isRetryAnotherBrokerWhenNotStoreOk());

    return producer;
}
 
开发者ID:QianmiOpen,项目名称:spring-boot-starter-rocketmq,代码行数:22,代码来源:RocketMQAutoConfiguration.java

示例5: tensorflowInputConverter

import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean(name = "tensorflowInputConverter")
@SuppressWarnings("unchecked")
public TensorflowInputConverter tensorflowInputConverter() {
	return new TensorflowInputConverter() {

		@Override
		public Map<String, Object> convert(Object input, Map<String, Object> processorContext) {

			if (input instanceof Map) {
				return (Map<String, Object>) input;
			}

			throw new MessageConversionException("Unsupported input format: " + input);
		}
	};
}
 
开发者ID:spring-cloud-stream-app-starters,项目名称:tensorflow,代码行数:18,代码来源:TensorflowCommonProcessorConfiguration.java

示例6: attributeRepositories

import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; //导入依赖的package包/类
@ConditionalOnMissingBean(name = "attributeRepositories")
@Bean
@RefreshScope
public List<IPersonAttributeDao> attributeRepositories() {
    final List<IPersonAttributeDao> list = new ArrayList<>();

    list.addAll(ldapAttributeRepositories());
    list.addAll(jdbcAttributeRepositories());
    list.addAll(jsonAttributeRepositories());
    list.addAll(groovyAttributeRepositories());
    list.addAll(grouperAttributeRepositories());
    list.addAll(stubAttributeRepositories());

    OrderComparator.sort(list);

    LOGGER.debug("Final list of attribute repositories is [{}]", list);
    return list;
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:19,代码来源:CasPersonDirectoryConfiguration.java

示例7: loggerFormats

import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean(LoggerFormats.class)
public LoggerFormats loggerFormats() {
    return LoggerFormats.builder()
            .enter("#${method.name}(${method.args}): "
                    + "entered")
            .warnBefore("#${method.name}(${method.args}): "
                    + "in ${method.duration} and still running (max ${method.warn.duration})")
            .warnAfter("#${method.name}(${method.args}): "
                    + "${method.result} in ${method.duration} (max ${method.warn.duration})")
            .after("#${method.name}(${method.args}): "
                    + "${method.result} in ${method.duration}")
            .error("#${method.name}(${method.args}): "
                    + "thrown ${error.class.name}(${error.message}) "
                    + "from ${error.source.class.name}[${error.source.line}] in ${method.duration}")
            .build();
}
 
开发者ID:rozidan,项目名称:logger-spring-boot,代码行数:18,代码来源:LoggerConfiguration.java

示例8: tarantoolClient

import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; //导入依赖的package包/类
@Bean(destroyMethod = "close")
@ConditionalOnMissingBean(name = "tarantoolClient")
public TarantoolClient tarantoolClient(
    SocketChannelProvider socketChannelProvider,
    TarantoolClientConfig config
) {
    return new TarantoolClientImpl(socketChannelProvider, config);
}
 
开发者ID:saladinkzn,项目名称:data-tarantool-spring-boot-starter,代码行数:9,代码来源:TarantoolAutoConfiguration.java

示例9: if

import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; //导入依赖的package包/类
@ConditionalOnMissingBean(name = "multifactorAuthenticationProviderSelector")
@Bean
@RefreshScope
public MultifactorAuthenticationProviderSelector multifactorAuthenticationProviderSelector() {
    final Resource script = casProperties.getAuthn().getMfa().getProviderSelectorGroovyScript();
    if (script != null) {
        return new GroovyScriptMultifactorAuthenticationProviderSelector(script);
    }

    return new RankedMultifactorAuthenticationProviderSelector();
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:12,代码来源:CasCoreWebflowConfiguration.java

示例10: accessTokenProvider

import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; //导入依赖的package包/类
@Bean(destroyMethod = "stop")
@ConditionalOnProperty({ "nakadi-producer.access-token-uri", "nakadi-producer.access-token-scopes" })
@ConditionalOnMissingBean(AccessTokenProvider.class)
public StupsTokenComponent accessTokenProvider(
        @Value("${nakadi-producer.access-token-uri}") URI accessTokenUri,
        @Value("${nakadi-producer.access-token-scopes}") String[] accessTokenScopes) {
    return new StupsTokenComponent(accessTokenUri, Arrays.asList(accessTokenScopes));
}
 
开发者ID:zalando-nakadi,项目名称:nakadi-producer-spring-boot-starter,代码行数:9,代码来源:NakadiProducerAutoConfiguration.java

示例11: myBatisMigrationsCliHandler

import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; //导入依赖的package包/类
/**
 * CLI handler bean
 * @param springApplicationArguments for CLI args
 * @return constructed MyBatisMigrationsCliHandler bean
 */
@Bean(name = MY_BATIS_MIGRATIONS_CLI_HANDLER_BEAN)
@ConditionalOnMissingBean
public MyBatisMigrationsCliHandler myBatisMigrationsCliHandler(
		ApplicationArguments springApplicationArguments) {
	return new MyBatisMigrationsCliHandler(springApplicationArguments.getSourceArgs());
}
 
开发者ID:Bessonov,项目名称:mybatis-migrations-spring-boot-autoconfigure,代码行数:12,代码来源:MyBatisMigrationsAutoConfiguration.java

示例12: configureActiveMQRespondMapComponent

import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; //导入依赖的package包/类
@Lazy
@Bean(name = "activemq-respond-map-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean
public ActiveMQRespondMapComponent configureActiveMQRespondMapComponent()
        throws Exception {
    ActiveMQRespondMapComponent connector = new ActiveMQRespondMapComponent();
    connector.setCamelContext(camelContext);
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    CamelPropertiesHelper.setCamelProperties(camelContext, connector,
            parameters, false);
    connector.setOptions(parameters);
    if (ObjectHelper.isNotEmpty(customizers)) {
        for (ConnectorCustomizer<ActiveMQRespondMapComponent> customizer : customizers) {
            boolean useCustomizer = (customizer instanceof HasId)
                    ? HierarchicalPropertiesEvaluator
                            .evaluate(
                                    applicationContext.getEnvironment(),
                                    "camel.connector.customizer",
                                    "camel.connector.activemq-respond-map.customizer",
                                    ((HasId) customizer).getId())
                    : HierarchicalPropertiesEvaluator
                            .evaluate(applicationContext.getEnvironment(),
                                    "camel.connector.customizer",
                                    "camel.connector.activemq-respond-map.customizer");
            if (useCustomizer) {
                LOGGER.debug("Configure connector {}, with customizer {}",
                        connector, customizer);
                customizer.customize(connector);
            }
        }
    }
    return connector;
}
 
开发者ID:syndesisio,项目名称:connectors,代码行数:37,代码来源:ActiveMQRespondMapConnectorAutoConfiguration.java

示例13: clickHouseDataSource

import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean
public ClickHouseDataSource clickHouseDataSource(Environment environment,
                                                 ClickHouseProperties clickHouseProperties) {
    return new ClickHouseDataSource(
            environment.getProperty("clickhouse.metrics.datasource.url", CLICKHOUSE_JDBC_URL),
            clickHouseProperties);
}
 
开发者ID:Camelion,项目名称:cmeter,代码行数:9,代码来源:ClickHouseExporterAutoConfiguration.java

示例14: sendTicketGrantingTicketAction

import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; //导入依赖的package包/类
@RefreshScope
@ConditionalOnMissingBean(name = "sendTicketGrantingTicketAction")
@Bean
public Action sendTicketGrantingTicketAction() {
    return new SendTicketGrantingTicketAction(centralAuthenticationService, servicesManager, ticketGrantingTicketCookieGenerator,
            casProperties.getSso().isRenewedAuthn());
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:8,代码来源:CasSupportActionsConfiguration.java

示例15: wxSessionManager

import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean
public WxSessionManager wxSessionManager() {
    return new DefaultWxSessionManager(wxProperties.getServer().getSessionTimeout(),
            wxProperties.getServer().getMaxActiveLimit(),
            BeanUtils.instantiate(wxProperties.getServer().getWxSessionIdGeneratorClass()));
}
 
开发者ID:FastBootWeixin,项目名称:FastBootWeixin,代码行数:8,代码来源:WxWebConfiguration.java


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