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   View source code 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   View source code 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   View source code 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   View source code 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: tensorflow   File: TensorflowCommonProcessorConfiguration.java   View source code 6 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 6
Project: cas-5.1.0   File: CasPersonDirectoryConfiguration.java   View source code 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 7
Project: logger-spring-boot   File: LoggerConfiguration.java   View source code 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 8
Project: data-tarantool-spring-boot-starter   File: TarantoolAutoConfiguration.java   View source code 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 9
Project: cas-5.1.0   File: CasCoreWebflowConfiguration.java   View source code 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 10
Project: nakadi-producer-spring-boot-starter   File: NakadiProducerAutoConfiguration.java   View source code 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 11
Project: mybatis-migrations-spring-boot-autoconfigure   File: MyBatisMigrationsAutoConfiguration.java   View source code 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 12
Project: connectors   File: ActiveMQRespondMapConnectorAutoConfiguration.java   View source code 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 13
Project: cmeter   File: ClickHouseExporterAutoConfiguration.java   View source code 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 14
Project: cas-5.1.0   File: CasSupportActionsConfiguration.java   View source code 5 votes vote down vote up
@RefreshScope
@ConditionalOnMissingBean(name = "sendTicketGrantingTicketAction")
@Bean
public Action sendTicketGrantingTicketAction() {
    return new SendTicketGrantingTicketAction(centralAuthenticationService, servicesManager, ticketGrantingTicketCookieGenerator,
            casProperties.getSso().isRenewedAuthn());
}
 
Example 15
Project: FastBootWeixin   File: WxWebConfiguration.java   View source code 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 16
Project: cas-5.1.0   File: CasCoreWebflowConfiguration.java   View source code 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 17
Project: connectors   File: SalesforceDeleteSObjectConnectorAutoConfiguration.java   View source code 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 18
Project: mapper-boot-starter   File: MapperAutoConfiguration.java   View source code 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 19
Project: cas-5.1.0   File: CasCoreServicesConfiguration.java   View source code 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 20
Project: cas-overlay   File: MyJdbcAuthenticationHandlers.java   View source code 5 votes vote down vote up
@ConditionalOnMissingBean(
        name = {"jdbcPrincipalFactory"}
)
@Bean
@RefreshScope
public PrincipalFactory jdbcPrincipalFactory() {
    return new DefaultPrincipalFactory();
}
 
Example 21
Project: spring-cloud-gcp   File: StorageAutoConfiguration.java   View source code 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 22
Project: cas-5.1.0   File: CasCoreAuditConfiguration.java   View source code 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 23
Project: connectors   File: SalesforceUpdateSObjectConnectorAutoConfiguration.java   View source code 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 24
Project: spring-cloud-netflix-zuul-websocket   File: ZuulWebSocketConfiguration.java   View source code 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 25
Project: connectors   File: DayTradeGetConnectorAutoConfiguration.java   View source code 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 26
Project: cas-5.1.0   File: CasCoreAuthenticationSupportConfiguration.java   View source code 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 27
Project: cas-5.1.0   File: CasManagementWebAppConfiguration.java   View source code 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 28
Project: cas-5.1.0   File: CasCoreLogoutConfiguration.java   View source code 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 29
Project: cas-5.1.0   File: ExternalShibbolethIdPAuthenticationServiceSelectionStrategyConfiguration.java   View source code 5 votes vote down vote up
@ConditionalOnMissingBean(name = "shibbolethIdPEntityIdAuthenticationServiceSelectionStrategy")
@Bean
@RefreshScope
public AuthenticationServiceSelectionStrategy shibbolethIdPEntityIdAuthenticationServiceSelectionStrategy() {
    return new ShibbolethIdPEntityIdAuthenticationServiceSelectionStrategy(webApplicationServiceFactory,
            casProperties.getAuthn().getShibIdP().getServerUrl());
}
 
Example 30
Project: syndesis   File: ActiveMQPublishConnectorAutoConfiguration.java   View source code 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 31
Project: spring-batch-support   File: SpringBatchDefaultServiceConfiguration.java   View source code 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 32
Project: cas-5.1.0   File: CasCoreWebflowConfiguration.java   View source code 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 33
Project: holon-jaxrs   File: ResteasyAutoConfiguration.java   View source code 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 34
Project: syndesis   File: SwaggerConnectorConnectorAutoConfiguration.java   View source code 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 35
Project: connectors   File: DayTradePlaceConnectorAutoConfiguration.java   View source code 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 36
Project: cas-5.1.0   File: CasSupportActionsConfiguration.java   View source code 5 votes vote down vote up
@RefreshScope
@Bean
@ConditionalOnMissingBean(name = "genericSuccessViewAction")
public Action genericSuccessViewAction() {
    return new GenericSuccessViewAction(centralAuthenticationService, servicesManager, webApplicationServiceFactory,
            casProperties.getView().getDefaultRedirectUrl());
}
 
Example 37
Project: cas-5.1.0   File: CasJdbcAuthenticationConfiguration.java   View source code 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 38
Project: cas-5.1.0   File: CasCoreHttpConfiguration.java   View source code 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 39
Project: connectors   File: ActiveMQRespondTextConnectorAutoConfiguration.java   View source code 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   View source code 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);
}