本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
示例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();
}
示例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;
}
示例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);
}
示例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());
}
示例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()));
}