當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。