Java Code Examples for org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean

The following are top voted examples for showing how to use org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: spring-i18n-support   File: SpringI18nSupportAutoConfiguration.java   Source Code and License 6 votes vote down vote up
@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;
}
 
Example 2
Project: spring-security-oauth2-boot   File: ResourceServerTokenServicesConfiguration.java   Source Code and License 6 votes vote down vote up
@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;
}
 
Example 3
Project: cas-5.1.0   File: CasValidationConfiguration.java   Source Code and License 6 votes vote down vote up
@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;
}
 
Example 4
Project: spring-boot-starter-rocketmq   File: RocketMQAutoConfiguration.java   Source Code and License 6 votes vote down vote up
@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;
}
 
Example 5
Project: cas-5.1.0   File: CasPersonDirectoryConfiguration.java   Source Code and License 6 votes vote down vote up
@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;
}
 
Example 6
Project: logger-spring-boot   File: LoggerConfiguration.java   Source Code and License 6 votes vote down vote up
@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();
}
 
Example 7
Project: data-tarantool-spring-boot-starter   File: TarantoolAutoConfiguration.java   Source Code and License 5 votes vote down vote up
@Bean(destroyMethod = "close")
@ConditionalOnMissingBean(name = "tarantoolClient")
public TarantoolClient tarantoolClient(
    SocketChannelProvider socketChannelProvider,
    TarantoolClientConfig config
) {
    return new TarantoolClientImpl(socketChannelProvider, config);
}
 
Example 8
Project: cas-5.1.0   File: CasCoreWebflowConfiguration.java   Source Code and License 5 votes vote down vote up
@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();
}
 
Example 9
Project: nakadi-producer-spring-boot-starter   File: NakadiProducerAutoConfiguration.java   Source Code and License 5 votes vote down vote up
@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));
}
 
Example 10
Project: mybatis-migrations-spring-boot-autoconfigure   File: MyBatisMigrationsAutoConfiguration.java   Source Code and License 5 votes vote down vote up
/**
 * 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());
}
 
Example 11
Project: connectors   File: ActiveMQRespondMapConnectorAutoConfiguration.java   Source Code and License 5 votes vote down vote up
@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;
}
 
Example 12
Project: cmeter   File: ClickHouseExporterAutoConfiguration.java   Source Code and License 5 votes vote down vote up
@Bean
@ConditionalOnMissingBean
public ClickHouseDataSource clickHouseDataSource(Environment environment,
                                                 ClickHouseProperties clickHouseProperties) {
    return new ClickHouseDataSource(
            environment.getProperty("clickhouse.metrics.datasource.url", CLICKHOUSE_JDBC_URL),
            clickHouseProperties);
}
 
Example 13
Project: cas-5.1.0   File: CasSupportActionsConfiguration.java   Source Code and License 5 votes vote down vote up
@RefreshScope
@ConditionalOnMissingBean(name = "sendTicketGrantingTicketAction")
@Bean
public Action sendTicketGrantingTicketAction() {
    return new SendTicketGrantingTicketAction(centralAuthenticationService, servicesManager, ticketGrantingTicketCookieGenerator,
            casProperties.getSso().isRenewedAuthn());
}
 
Example 14
Project: FastBootWeixin   File: WxWebConfiguration.java   Source Code and License 5 votes vote down vote up
@Bean
@ConditionalOnMissingBean
public WxSessionManager wxSessionManager() {
    return new DefaultWxSessionManager(wxProperties.getServer().getSessionTimeout(),
            wxProperties.getServer().getMaxActiveLimit(),
            BeanUtils.instantiate(wxProperties.getServer().getWxSessionIdGeneratorClass()));
}
 
Example 15
Project: cas-5.1.0   File: CasCoreWebflowConfiguration.java   Source Code and License 5 votes vote down vote up
@ConditionalOnMissingBean(name = "globalAuthenticationPolicyWebflowEventResolver")
@Bean
@RefreshScope
public CasWebflowEventResolver globalAuthenticationPolicyWebflowEventResolver() {
    return new GlobalMultifactorAuthenticationPolicyEventResolver(authenticationSystemSupport,
            centralAuthenticationService, servicesManager,
            ticketRegistrySupport, warnCookieGenerator,
            authenticationRequestServiceSelectionStrategies, selector, casProperties);
}
 
Example 16
Project: connectors   File: SalesforceDeleteSObjectConnectorAutoConfiguration.java   Source Code and License 5 votes vote down vote up
@Lazy
@Bean(name = "salesforce-delete-sobject-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean
public SalesforceDeleteSObjectComponent configureSalesforceDeleteSObjectComponent()
        throws Exception {
    SalesforceDeleteSObjectComponent connector = new SalesforceDeleteSObjectComponent();
    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<SalesforceDeleteSObjectComponent> customizer : customizers) {
            boolean useCustomizer = (customizer instanceof HasId)
                    ? HierarchicalPropertiesEvaluator
                            .evaluate(
                                    applicationContext.getEnvironment(),
                                    "camel.connector.customizer",
                                    "camel.connector.salesforce-delete-sobject.customizer",
                                    ((HasId) customizer).getId())
                    : HierarchicalPropertiesEvaluator
                            .evaluate(applicationContext.getEnvironment(),
                                    "camel.connector.customizer",
                                    "camel.connector.salesforce-delete-sobject.customizer");
            if (useCustomizer) {
                LOGGER.debug("Configure connector {}, with customizer {}",
                        connector, customizer);
                customizer.customize(connector);
            }
        }
    }
    return connector;
}
 
Example 17
Project: mapper-boot-starter   File: MapperAutoConfiguration.java   Source Code and License 5 votes vote down vote up
@Bean
@ConditionalOnMissingBean
public SqlSessionTemplate sqlSessionTemplate(SqlSessionFactory sqlSessionFactory) {
    ExecutorType executorType = this.properties.getExecutorType();
    if (executorType != null) {
        return new SqlSessionTemplate(sqlSessionFactory, executorType);
    } else {
        return new SqlSessionTemplate(sqlSessionFactory);
    }
}
 
Example 18
Project: cas-5.1.0   File: CasCoreServicesConfiguration.java   Source Code and License 5 votes vote down vote up
@Autowired
@ConditionalOnMissingBean(name = "jsonServiceRegistryDao")
@Bean
public ServiceRegistryInitializer serviceRegistryInitializer(@Qualifier(BEAN_NAME_SERVICE_REGISTRY_DAO) final ServiceRegistryDao serviceRegistryDao) {
    return new ServiceRegistryInitializer(embeddedJsonServiceRegistry(eventPublisher), serviceRegistryDao, servicesManager(serviceRegistryDao),
            casProperties.getServiceRegistry().isInitFromJson());
}
 
Example 19
Project: cas-overlay   File: MyJdbcAuthenticationHandlers.java   Source Code and License 5 votes vote down vote up
@ConditionalOnMissingBean(
        name = {"jdbcPrincipalFactory"}
)
@Bean
@RefreshScope
public PrincipalFactory jdbcPrincipalFactory() {
    return new DefaultPrincipalFactory();
}
 
Example 20
Project: spring-cloud-gcp   File: StorageAutoConfiguration.java   Source Code and License 5 votes vote down vote up
@Bean
@ConditionalOnMissingBean
public static Storage storage(CredentialsProvider credentialsProvider,
		GcpStorageProperties gcpStorageProperties) throws IOException {
	return StorageOptions.newBuilder()
			.setCredentials(gcpStorageProperties.getCredentials().getLocation() != null
					? GoogleCredentials
							.fromStream(gcpStorageProperties.getCredentials()
									.getLocation().getInputStream())
							.createScoped(gcpStorageProperties.getCredentials().getScopes())
					: credentialsProvider.getCredentials())
			.build().getService();
}
 
Example 21
Project: cas-5.1.0   File: CasCoreAuditConfiguration.java   Source Code and License 5 votes vote down vote up
@ConditionalOnMissingBean(name = "auditActionResolverMap")
@Bean
public Map<String, AuditActionResolver> auditActionResolverMap() {
    final Map<String, AuditActionResolver> map = new HashMap<>();

    final AuditActionResolver resolver = authenticationActionResolver();
    map.put("AUTHENTICATION_RESOLVER", resolver);
    map.put("SAVE_SERVICE_ACTION_RESOLVER", resolver);
    map.put("CHANGE_PASSWORD_ACTION_RESOLVER", resolver);

    final AuditActionResolver defResolver = new DefaultAuditActionResolver();
    map.put("DESTROY_TICKET_GRANTING_TICKET_RESOLVER", defResolver);
    map.put("DESTROY_PROXY_GRANTING_TICKET_RESOLVER", defResolver);

    final AuditActionResolver cResolver = ticketCreationActionResolver();
    map.put("CREATE_PROXY_GRANTING_TICKET_RESOLVER", cResolver);
    map.put("GRANT_SERVICE_TICKET_RESOLVER", cResolver);
    map.put("GRANT_PROXY_TICKET_RESOLVER", cResolver);
    map.put("CREATE_TICKET_GRANTING_TICKET_RESOLVER", cResolver);
    map.put("TRUSTED_AUTHENTICATION_ACTION_RESOLVER", cResolver);

    map.put("AUTHENTICATION_EVENT_ACTION_RESOLVER", new DefaultAuditActionResolver("_TRIGGERED", StringUtils.EMPTY));
    final AuditActionResolver adResolver = new DefaultAuditActionResolver();
    map.put("ADAPTIVE_RISKY_AUTHENTICATION_ACTION_RESOLVER", adResolver);

    map.put("VALIDATE_SERVICE_TICKET_RESOLVER", ticketValidationActionResolver());

    return map;
}
 
Example 22
Project: connectors   File: SalesforceUpdateSObjectConnectorAutoConfiguration.java   Source Code and License 5 votes vote down vote up
@Lazy
@Bean(name = "salesforce-update-sobject-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean
public SalesforceUpdateSObjectComponent configureSalesforceUpdateSObjectComponent()
        throws Exception {
    SalesforceUpdateSObjectComponent connector = new SalesforceUpdateSObjectComponent();
    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<SalesforceUpdateSObjectComponent> customizer : customizers) {
            boolean useCustomizer = (customizer instanceof HasId)
                    ? HierarchicalPropertiesEvaluator
                            .evaluate(
                                    applicationContext.getEnvironment(),
                                    "camel.connector.customizer",
                                    "camel.connector.salesforce-update-sobject.customizer",
                                    ((HasId) customizer).getId())
                    : HierarchicalPropertiesEvaluator
                            .evaluate(applicationContext.getEnvironment(),
                                    "camel.connector.customizer",
                                    "camel.connector.salesforce-update-sobject.customizer");
            if (useCustomizer) {
                LOGGER.debug("Configure connector {}, with customizer {}",
                        connector, customizer);
                customizer.customize(connector);
            }
        }
    }
    return connector;
}
 
Example 23
Project: spring-cloud-netflix-zuul-websocket   File: ZuulWebSocketConfiguration.java   Source Code and License 5 votes vote down vote up
@Bean
@ConditionalOnMissingBean(ProxyWebSocketErrorHandler.class)
public ProxyWebSocketErrorHandler proxyWebSocketErrorHandler() {
    Set<ProxyWebSocketErrorHandler> handlerSet = new HashSet<>();
    handlerSet.add(new DefaultProxyWebSocketErrorHandler());
    handlerSet.add(new ReconnectErrorHandler());

    return new CompositeErrorHandler(handlerSet);
}
 
Example 24
Project: connectors   File: DayTradeGetConnectorAutoConfiguration.java   Source Code and License 5 votes vote down vote up
@Lazy
@Bean(name = "day-trade-get-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean
public DayTradeGetComponent configureDayTradeGetComponent()
        throws Exception {
    DayTradeGetComponent connector = new DayTradeGetComponent();
    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<DayTradeGetComponent> customizer : customizers) {
            boolean useCustomizer = (customizer instanceof HasId)
                    ? HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.connector.customizer",
                            "camel.connector.day-trade-get.customizer",
                            ((HasId) customizer).getId())
                    : HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.connector.customizer",
                            "camel.connector.day-trade-get.customizer");
            if (useCustomizer) {
                LOGGER.debug("Configure connector {}, with customizer {}",
                        connector, customizer);
                customizer.customize(connector);
            }
        }
    }
    return connector;
}
 
Example 25
Project: cas-5.1.0   File: CasCoreAuthenticationSupportConfiguration.java   Source Code and License 5 votes vote down vote up
@RefreshScope
@Bean
@ConditionalOnMissingBean(name = "authenticationContextValidator")
public AuthenticationContextValidator authenticationContextValidator() {
    final String contextAttribute = casProperties.getAuthn().getMfa().getAuthenticationContextAttribute();
    final String failureMode = casProperties.getAuthn().getMfa().getGlobalFailureMode();
    final String authnAttributeName = casProperties.getAuthn().getMfa().getTrusted().getAuthenticationContextAttribute();
    return new DefaultAuthenticationContextValidator(contextAttribute, failureMode, authnAttributeName);
}
 
Example 26
Project: cas-5.1.0   File: CasManagementWebAppConfiguration.java   Source Code and License 5 votes vote down vote up
@ConditionalOnMissingBean(name = "authorizationGenerator")
@Bean
@RefreshScope
public AuthorizationGenerator authorizationGenerator() {
    final List<String> authzAttributes = casProperties.getMgmt().getAuthzAttributes();
    if (!authzAttributes.isEmpty()) {
        if ("*".equals(authzAttributes)) {
            return new PermitAllAuthorizationGenerator();
        }
        return new FromAttributesAuthorizationGenerator(authzAttributes.toArray(new String[]{}), new String[]{});
    }
    return new SpringSecurityPropertiesAuthorizationGenerator(userProperties());
}
 
Example 27
Project: cas-5.1.0   File: CasCoreLogoutConfiguration.java   Source Code and License 5 votes vote down vote up
@ConditionalOnMissingBean(name = "defaultSingleLogoutServiceMessageHandler")
@Bean
public SingleLogoutServiceMessageHandler defaultSingleLogoutServiceMessageHandler() {
    return new DefaultSingleLogoutServiceMessageHandler(httpClient,
            logoutBuilder(),
            servicesManager,
            singleLogoutServiceLogoutUrlBuilder(),
            casProperties.getSlo().isAsynchronous(),
            authenticationRequestServiceSelectionStrategies);
}
 
Example 28
Project: cas-5.1.0   File: ExternalShibbolethIdPAuthenticationServiceSelectionStrategyConfiguration.java   Source Code and License 5 votes vote down vote up
@ConditionalOnMissingBean(name = "shibbolethIdPEntityIdAuthenticationServiceSelectionStrategy")
@Bean
@RefreshScope
public AuthenticationServiceSelectionStrategy shibbolethIdPEntityIdAuthenticationServiceSelectionStrategy() {
    return new ShibbolethIdPEntityIdAuthenticationServiceSelectionStrategy(webApplicationServiceFactory,
            casProperties.getAuthn().getShibIdP().getServerUrl());
}
 
Example 29
Project: syndesis   File: ActiveMQPublishConnectorAutoConfiguration.java   Source Code and License 5 votes vote down vote up
@Lazy
@Bean(name = "activemq-publish-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean
public ActiveMQPublishComponent configureActiveMQPublishComponent()
        throws Exception {
    ActiveMQPublishComponent connector = new ActiveMQPublishComponent();
    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<ActiveMQPublishComponent> customizer : customizers) {
            boolean useCustomizer = (customizer instanceof HasId)
                    ? HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.connector.customizer",
                            "camel.connector.activemq-publish.customizer",
                            ((HasId) customizer).getId())
                    : HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.connector.customizer",
                            "camel.connector.activemq-publish.customizer");
            if (useCustomizer) {
                LOGGER.debug("Configure connector {}, with customizer {}",
                        connector, customizer);
                customizer.customize(connector);
            }
        }
    }
    return connector;
}
 
Example 30
Project: spring-batch-support   File: SpringBatchDefaultServiceConfiguration.java   Source Code and License 5 votes vote down vote up
@Bean
	@ConditionalOnMissingBean(JobRepository.class)
	public JobRepository getJobRepository() throws Exception {
		BatchConfigurer batchConfigurer = getBatchConfigurer();
		if (batchConfigurer != null) {
			return batchConfigurer.getJobRepository();
		}
		JobRepositoryFactoryBean factory = new JobRepositoryFactoryBean();
		factory.setDataSource(dataSource);
		factory.setTransactionManager(transactionManager);
		factory.afterPropertiesSet();
//		factory.setIsolationLevelForCreate("ISOLATION_DEFAULT");
		return factory.getObject();
	}
 
Example 31
Project: cas-5.1.0   File: CasCoreWebflowConfiguration.java   Source Code and License 5 votes vote down vote up
@ConditionalOnMissingBean(name = "registeredServiceAuthenticationPolicyWebflowEventResolver")
@Bean
@RefreshScope
public CasWebflowEventResolver registeredServiceAuthenticationPolicyWebflowEventResolver() {
    return new RegisteredServiceMultifactorAuthenticationPolicyEventResolver(authenticationSystemSupport,
            centralAuthenticationService, servicesManager,
            ticketRegistrySupport, warnCookieGenerator,
            authenticationRequestServiceSelectionStrategies, selector);
}
 
Example 32
Project: holon-jaxrs   File: ResteasyAutoConfiguration.java   Source Code and License 5 votes vote down vote up
@Bean
@ConditionalOnMissingBean(name = "jerseyFilterRegistration")
@ConditionalOnProperty(prefix = "holon.resteasy", name = "type", havingValue = "filter")
public FilterRegistrationBean resteasyFilterRegistration() {
	final Filter filter = new Filter30Dispatcher();
	FilterRegistrationBean registration = new FilterRegistrationBean();
	registration.setFilter(filter);
	registration.setUrlPatterns(Arrays.asList(this.path));
	registration.setOrder(this.resteasy.getFilter().getOrder());
	registration.setName("resteasyFilter");
	registration.setDispatcherTypes(EnumSet.allOf(DispatcherType.class));
	return registration;
}
 
Example 33
Project: syndesis   File: SwaggerConnectorConnectorAutoConfiguration.java   Source Code and License 5 votes vote down vote up
@Lazy
@Bean(name = "swagger-operation-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean
public SwaggerConnectorComponent configureSwaggerConnectorComponent()
        throws Exception {
    SwaggerConnectorComponent connector = new SwaggerConnectorComponent();
    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<SwaggerConnectorComponent> customizer : customizers) {
            boolean useCustomizer = (customizer instanceof HasId)
                    ? HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.connector.customizer",
                            "camel.connector.swagger-operation.customizer",
                            ((HasId) customizer).getId())
                    : HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.connector.customizer",
                            "camel.connector.swagger-operation.customizer");
            if (useCustomizer) {
                LOGGER.debug("Configure connector {}, with customizer {}",
                        connector, customizer);
                customizer.customize(connector);
            }
        }
    }
    return connector;
}
 
Example 34
Project: connectors   File: DayTradePlaceConnectorAutoConfiguration.java   Source Code and License 5 votes vote down vote up
@Lazy
@Bean(name = "day-trade-place-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean
public DayTradePlaceComponent configureDayTradePlaceComponent()
        throws Exception {
    DayTradePlaceComponent connector = new DayTradePlaceComponent();
    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<DayTradePlaceComponent> customizer : customizers) {
            boolean useCustomizer = (customizer instanceof HasId)
                    ? HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.connector.customizer",
                            "camel.connector.day-trade-place.customizer",
                            ((HasId) customizer).getId())
                    : HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.connector.customizer",
                            "camel.connector.day-trade-place.customizer");
            if (useCustomizer) {
                LOGGER.debug("Configure connector {}, with customizer {}",
                        connector, customizer);
                customizer.customize(connector);
            }
        }
    }
    return connector;
}
 
Example 35
Project: cas-5.1.0   File: CasSupportActionsConfiguration.java   Source Code and License 5 votes vote down vote up
@RefreshScope
@Bean
@ConditionalOnMissingBean(name = "genericSuccessViewAction")
public Action genericSuccessViewAction() {
    return new GenericSuccessViewAction(centralAuthenticationService, servicesManager, webApplicationServiceFactory,
            casProperties.getView().getDefaultRedirectUrl());
}
 
Example 36
Project: cas-5.1.0   File: CasJdbcAuthenticationConfiguration.java   Source Code and License 5 votes vote down vote up
@ConditionalOnMissingBean(name = "jdbcAuthenticationHandlers")
@Bean
@RefreshScope
public Collection<AuthenticationHandler> jdbcAuthenticationHandlers() {
    final Collection<AuthenticationHandler> handlers = new HashSet<>();
    final JdbcAuthenticationProperties jdbc = casProperties.getAuthn().getJdbc();
    jdbc.getBind().forEach(b -> handlers.add(bindModeSearchDatabaseAuthenticationHandler(b)));
    jdbc.getEncode().forEach(b -> handlers.add(queryAndEncodeDatabaseAuthenticationHandler(b)));
    jdbc.getQuery().forEach(b -> handlers.add(queryDatabaseAuthenticationHandler(b)));
    jdbc.getSearch().forEach(b -> handlers.add(searchModeSearchDatabaseAuthenticationHandler(b)));
    return handlers;
}
 
Example 37
Project: cas-5.1.0   File: CasCoreHttpConfiguration.java   Source Code and License 5 votes vote down vote up
@ConditionalOnMissingBean(name = "httpClient")
@Bean
public FactoryBean<SimpleHttpClient> httpClient() {
    final SimpleHttpClientFactoryBean.DefaultHttpClient c = new SimpleHttpClientFactoryBean.DefaultHttpClient();
    c.setConnectionTimeout(casProperties.getHttpClient().getConnectionTimeout());
    c.setReadTimeout(Long.valueOf(casProperties.getHttpClient().getReadTimeout()).intValue());
    return c;
}
 
Example 38
Project: tensorflow   File: TensorflowCommonProcessorConfiguration.java   Source Code and License 5 votes vote down vote up
@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);
		}
	};
}
 
Example 39
Project: connectors   File: ActiveMQRespondTextConnectorAutoConfiguration.java   Source Code and License 5 votes vote down vote up
@Lazy
@Bean(name = "activemq-respond-text-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean
public ActiveMQRespondTextComponent configureActiveMQRespondTextComponent()
        throws Exception {
    ActiveMQRespondTextComponent connector = new ActiveMQRespondTextComponent();
    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<ActiveMQRespondTextComponent> customizer : customizers) {
            boolean useCustomizer = (customizer instanceof HasId)
                    ? HierarchicalPropertiesEvaluator
                            .evaluate(
                                    applicationContext.getEnvironment(),
                                    "camel.connector.customizer",
                                    "camel.connector.activemq-respond-text.customizer",
                                    ((HasId) customizer).getId())
                    : HierarchicalPropertiesEvaluator
                            .evaluate(applicationContext.getEnvironment(),
                                    "camel.connector.customizer",
                                    "camel.connector.activemq-respond-text.customizer");
            if (useCustomizer) {
                LOGGER.debug("Configure connector {}, with customizer {}",
                        connector, customizer);
                customizer.customize(connector);
            }
        }
    }
    return connector;
}
 
Example 40
Project: quickfixj-spring-boot-starter   File: QuickFixJServerEndpointAutoConfiguration.java   Source Code and License 5 votes vote down vote up
@Bean
@ConditionalOnBean(name = {"serverAcceptor", "serverSessionSettings"})
@ConditionalOnClass({Acceptor.class, SessionSettings.class})
@ConditionalOnMissingBean
@ConditionalOnEnabledEndpoint("quickfixjserver")
public QuickFixJServerEndpoint quickfixjServerEndpoint(Acceptor serverAcceptor, SessionSettings serverSessionSettings) {
    return new QuickFixJServerEndpoint(serverAcceptor, serverSessionSettings);
}
 
Example 41
Project: cas-5.1.0   File: CasValidationConfiguration.java   Source Code and License 5 votes vote down vote up
@Autowired
@Bean
@ConditionalOnMissingBean(name = "legacyValidateController")
public LegacyValidateController legacyValidateController(@Qualifier("argumentExtractor") final ArgumentExtractor argumentExtractor,
                                                         @Qualifier("defaultAuthenticationSystemSupport")
                                                         final AuthenticationSystemSupport authenticationSystemSupport) {
    final LegacyValidateController c = new LegacyValidateController();
    c.setValidationSpecification(this.cas10ProtocolValidationSpecification);
    c.setSuccessView(cas1ServiceSuccessView());
    c.setFailureView(cas1ServiceFailureView());
    c.setProxyHandler(proxy10Handler);
    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;
}
 
Example 42
Project: xitikit-blue   File: B2CServicesAutoConfiguration.java   Source Code and License 5 votes vote down vote up
@Bean
@Autowired
@ConditionalOnMissingBean(NonceStore.class)
@ConditionalOnProperty(prefix = "blue-kit.b2c.nonce", name = "disabled", havingValue = "false")
public NonceStore blueKitNonceStore(final NonceProperties nonceProperties){
    //TODO: Add logic for checking whether a shared caching framework is enabled
    return new GreedyNonceStore(nonceProperties.getTimeout());
}
 
Example 43
Project: albedo-thrift   File: CommonAutoConfiguration.java   Source Code and License 5 votes vote down vote up
@Bean
@ConditionalOnMissingBean
public RetryPolicy exponentialBackoffRetry(AlbedoRpcProperties albedoRpcProperties) {
    AlbedoRpcProperties.Zookeeper zookeeper = albedoRpcProperties.getZookeeper();
    Integer baseSleepTimeMs = Integer.parseInt(environment.getProperty("albedo.rpc.zookeeper.baseSleepTimeMs",
            zookeeper.getBaseSleepTimeMs()+"")),
            maxRetries = Integer.parseInt(environment.getProperty("albedo.rpc.zookeeper.maxRetries",
            zookeeper.getMaxRetries()+"")),
            maxSleepMs = Integer.parseInt(environment.getProperty("albedo.rpc.zookeeper.maxSleepMs",
                    zookeeper.getMaxSleepMs()+""));
    return new ExponentialBackoffRetry(baseSleepTimeMs,
            maxRetries, maxSleepMs);
}
 
Example 44
Project: azure-spring-boot   File: DocumentDBAutoConfiguration.java   Source Code and License 5 votes vote down vote up
@Bean
@ConditionalOnMissingBean
@ConditionalOnProperty(prefix = "azure.documentdb", value = "database")
public DocumentDbTemplate documentDbTemplate(DocumentDbFactory documentDbFactory,
                                             MappingDocumentDbConverter mappingDocumentDbConverter) {
    return new DocumentDbTemplate(documentDbFactory, mappingDocumentDbConverter,
            properties.getDatabase());
}
 
Example 45
Project: connectors   File: ActiveMQPublishBytesConnectorAutoConfiguration.java   Source Code and License 5 votes vote down vote up
@Lazy
@Bean(name = "activemq-publish-bytes-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean
public ActiveMQPublishBytesComponent configureActiveMQPublishBytesComponent()
        throws Exception {
    ActiveMQPublishBytesComponent connector = new ActiveMQPublishBytesComponent();
    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<ActiveMQPublishBytesComponent> customizer : customizers) {
            boolean useCustomizer = (customizer instanceof HasId)
                    ? HierarchicalPropertiesEvaluator
                            .evaluate(
                                    applicationContext.getEnvironment(),
                                    "camel.connector.customizer",
                                    "camel.connector.activemq-publish-bytes.customizer",
                                    ((HasId) customizer).getId())
                    : HierarchicalPropertiesEvaluator
                            .evaluate(applicationContext.getEnvironment(),
                                    "camel.connector.customizer",
                                    "camel.connector.activemq-publish-bytes.customizer");
            if (useCustomizer) {
                LOGGER.debug("Configure connector {}, with customizer {}",
                        connector, customizer);
                customizer.customize(connector);
            }
        }
    }
    return connector;
}
 
Example 46
Project: cas-5.1.0   File: OpenIdAuthenticationEventExecutionPlanConfiguration.java   Source Code and License 4 votes vote down vote up
@ConditionalOnMissingBean(name = "openidPrincipalFactory")
@Bean
public PrincipalFactory openidPrincipalFactory() {
    return new DefaultPrincipalFactory();
}
 
Example 47
Project: cas-5.1.0   File: CasSupportActionsConfiguration.java   Source Code and License 4 votes vote down vote up
@RefreshScope
@Bean
@ConditionalOnMissingBean(name = "initialAuthenticationRequestValidationAction")
public Action initialAuthenticationRequestValidationAction() {
    return new InitialAuthenticationRequestValidationAction(rankedAuthenticationProviderWebflowEventResolver);
}
 
Example 48
Project: micrometer   File: MeterBindersConfiguration.java   Source Code and License 4 votes vote down vote up
@Bean
@ConditionalOnProperty(value = "management.metrics.binders.jvm.enabled", matchIfMissing = true)
@ConditionalOnMissingBean
public JvmThreadMetrics jvmThreadMetrics() {
    return new JvmThreadMetrics();
}
 
Example 49
Project: spring-boot-data-source-decorator   File: DataSourceProxyConfiguration.java   Source Code and License 4 votes vote down vote up
@Bean
@ConditionalOnMissingBean
@ConditionalOnProperty(value = "decorator.datasource.datasource-proxy.count-query", havingValue = "true")
public QueryCountStrategy queryCountStrategy() {
    return new SingleQueryCountHolder();
}
 
Example 50
Project: EasyTransaction   File: RestRibbonEasyTransRpcConfiguration.java   Source Code and License 4 votes vote down vote up
@Bean
@ConditionalOnMissingBean(EasyTransRpcProvider.class)
public RestRibbonEasyTransRpcProviderImpl restRibbonEasyTransRpcProviderImpl(EasyTransFilterChainFactory filterChainFactory, ObjectSerializer serializer){
	return new RestRibbonEasyTransRpcProviderImpl(filterChainFactory, serializer);
}
 
Example 51
Project: cas-5.1.0   File: SurrogateAuthenticationConfiguration.java   Source Code and License 4 votes vote down vote up
@ConditionalOnMissingBean(name = "selectSurrogateAction")
@Bean
public Action selectSurrogateAction() {
    return new SurrogateSelectionAction(casProperties.getAuthn().getSurrogate().getSeparator());
}
 
Example 52
Project: EasyTransaction   File: EasyTransCoreConfiguration.java   Source Code and License 4 votes vote down vote up
@Bean
@ConditionalOnMissingBean(EasyTransMsgListener.class)
public EasyTransMsgInitializer easyTransMsgInitializer(ListableProviderFactory serviceWareHouse, EasyTransMsgConsumer consumer,
		EasyTransFilterChainFactory filterChainFactory){
	return new EasyTransMsgInitializer(serviceWareHouse, consumer, filterChainFactory, applicationName);
}
 
Example 53
Project: EasyTransaction   File: EasyTransCoreConfiguration.java   Source Code and License 4 votes vote down vote up
@Bean
@ConditionalOnMissingBean(IdempotentHandlerFilter.class)
public DefaultIdempotentHandlerFilter idempotentHandlerFilter(IdempotentHelper helper, ObjectSerializer serializer){
	return new DefaultIdempotentHandlerFilter(helper, serializer);
}
 
Example 54
Project: extended-actuator-health-endpoints   File: ExtendedHealthEndpointAutoConfiguration.java   Source Code and License 4 votes vote down vote up
@Bean
@ConditionalOnMissingBean(ApplicationAliveIndicator.class)
public ApplicationAliveIndicator defaultApplicationAliveIndicator(ApplicationContext applicationContext) {
    return new DefaultApplicationAliveIndicator(applicationContext);
}
 
Example 55
Project: cas-5.1.0   File: SpnegoConfiguration.java   Source Code and License 4 votes vote down vote up
@ConditionalOnMissingBean(name = "spnegoPrincipalFactory")
@Bean
public PrincipalFactory spnegoPrincipalFactory() {
    return new DefaultPrincipalFactory();
}
 
Example 56
Project: holon-json   File: GsonAutoConfiguration.java   Source Code and License 4 votes vote down vote up
@Bean
@ConditionalOnMissingBean
public Gson gson() {
	return GsonConfiguration.builder().create();
}
 
Example 57
Project: cas-5.1.0   File: AzureAuthenticatorAuthenticationEventExecutionPlanConfiguration.java   Source Code and License 4 votes vote down vote up
@ConditionalOnMissingBean(name = "azurePrincipalFactory")
@Bean
public PrincipalFactory azurePrincipalFactory() {
    return new DefaultPrincipalFactory();
}
 
Example 58
Project: nakadi-producer-spring-boot-starter   File: NakadiProducerAutoConfiguration.java   Source Code and License 4 votes vote down vote up
@Bean
@ConditionalOnMissingClass("org.zalando.tracer.Tracer")
@ConditionalOnMissingBean(FlowIdComponent.class)
public FlowIdComponent flowIdComponent() {
    return new NoopFlowIdComponent();
}
 
Example 59
Project: EasyTransaction   File: OnsQueueConfiguration.java   Source Code and License 4 votes vote down vote up
@Bean
@ConditionalOnMissingBean(EasyTransMsgConsumer.class)
public EasyTransMsgConsumer onsEasyTransMsgConsumerImpl(OnsQueueProperties properties, ObjectSerializer serializer){
	return new OnsEasyTransMsgConsumerImpl(properties.getConsumer(),serializer);
}
 
Example 60
Project: cas-5.1.0   File: CasCoreTicketsConfiguration.java   Source Code and License 4 votes vote down vote up
@ConditionalOnMissingBean(name = "proxy10Handler")
@Bean
public ProxyHandler proxy10Handler() {
    return new Cas10ProxyHandler();
}