org.springframework.boot.autoconfigure.condition.ConditionalOnExpression Java Examples

The following examples show how to use org.springframework.boot.autoconfigure.condition.ConditionalOnExpression. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DatabaseConfiguration.java    From klask-io with GNU General Public License v3.0 6 votes vote down vote up
@Bean(destroyMethod = "close")
@ConditionalOnExpression("#{!environment.acceptsProfiles('" + Constants.SPRING_PROFILE_CLOUD + "') && !environment.acceptsProfiles('" + Constants.SPRING_PROFILE_HEROKU + "')}")
@ConfigurationProperties(prefix = "spring.datasource.hikari")
public DataSource dataSource(DataSourceProperties dataSourceProperties) {
    log.debug("Configuring Datasource");
    if (dataSourceProperties.getUrl() == null) {
        log.error("Your database connection pool configuration is incorrect! The application" +
                " cannot start. Please check your Spring profile, current profiles are: {}",
            Arrays.toString(env.getActiveProfiles()));

        throw new ApplicationContextException("Database connection pool is not configured correctly");
    }
    HikariDataSource hikariDataSource =  (HikariDataSource) DataSourceBuilder
            .create(dataSourceProperties.getClassLoader())
            .type(HikariDataSource.class)
            .driverClassName(dataSourceProperties.getDriverClassName())
            .url(dataSourceProperties.getUrl())
            .username(dataSourceProperties.getUsername())
            .password(dataSourceProperties.getPassword())
            .build();

    if (metricRegistry != null) {
        hikariDataSource.setMetricRegistry(metricRegistry);
    }
    return hikariDataSource;
}
 
Example #2
Source File: DatabaseConfiguration.java    From jhipster-ribbon-hystrix with GNU General Public License v3.0 6 votes vote down vote up
@Bean(destroyMethod = "close")
@ConditionalOnExpression("#{!environment.acceptsProfiles('" + Constants.SPRING_PROFILE_CLOUD + "') && !environment.acceptsProfiles('" + Constants.SPRING_PROFILE_HEROKU + "')}")
@ConfigurationProperties(prefix = "spring.datasource.hikari")
public DataSource dataSource(DataSourceProperties dataSourceProperties) {
    log.debug("Configuring Datasource");
    if (dataSourceProperties.getUrl() == null) {
        log.error("Your database connection pool configuration is incorrect! The application" +
                " cannot start. Please check your Spring profile, current profiles are: {}",
            Arrays.toString(env.getActiveProfiles()));

        throw new ApplicationContextException("Database connection pool is not configured correctly");
    }
    HikariDataSource hikariDataSource =  (HikariDataSource) DataSourceBuilder
            .create(dataSourceProperties.getClassLoader())
            .type(HikariDataSource.class)
            .driverClassName(dataSourceProperties.getDriverClassName())
            .url(dataSourceProperties.getUrl())
            .username(dataSourceProperties.getUsername())
            .password(dataSourceProperties.getPassword())
            .build();

    if (metricRegistry != null) {
        hikariDataSource.setMetricRegistry(metricRegistry);
    }
    return hikariDataSource;
}
 
Example #3
Source File: DatabaseConfiguration.java    From jhipster-ribbon-hystrix with GNU General Public License v3.0 6 votes vote down vote up
@Bean(destroyMethod = "close")
@ConditionalOnExpression("#{!environment.acceptsProfiles('" + Constants.SPRING_PROFILE_CLOUD + "') && !environment.acceptsProfiles('" + Constants.SPRING_PROFILE_HEROKU + "')}")
@ConfigurationProperties(prefix = "spring.datasource.hikari")
public DataSource dataSource(DataSourceProperties dataSourceProperties) {
    log.debug("Configuring Datasource");
    if (dataSourceProperties.getUrl() == null) {
        log.error("Your database connection pool configuration is incorrect! The application" +
                " cannot start. Please check your Spring profile, current profiles are: {}",
            Arrays.toString(env.getActiveProfiles()));

        throw new ApplicationContextException("Database connection pool is not configured correctly");
    }
    HikariDataSource hikariDataSource =  (HikariDataSource) DataSourceBuilder
            .create(dataSourceProperties.getClassLoader())
            .type(HikariDataSource.class)
            .driverClassName(dataSourceProperties.getDriverClassName())
            .url(dataSourceProperties.getUrl())
            .username(dataSourceProperties.getUsername())
            .password(dataSourceProperties.getPassword())
            .build();

    if (metricRegistry != null) {
        hikariDataSource.setMetricRegistry(metricRegistry);
    }
    return hikariDataSource;
}
 
Example #4
Source File: DatabaseConfiguration.java    From jhipster-ribbon-hystrix with GNU General Public License v3.0 6 votes vote down vote up
@Bean(destroyMethod = "close")
@ConditionalOnExpression("#{!environment.acceptsProfiles('" + Constants.SPRING_PROFILE_CLOUD + "') && !environment.acceptsProfiles('" + Constants.SPRING_PROFILE_HEROKU + "')}")
@ConfigurationProperties(prefix = "spring.datasource.hikari")
public DataSource dataSource(DataSourceProperties dataSourceProperties) {
    log.debug("Configuring Datasource");
    if (dataSourceProperties.getUrl() == null) {
        log.error("Your database connection pool configuration is incorrect! The application" +
                " cannot start. Please check your Spring profile, current profiles are: {}",
            Arrays.toString(env.getActiveProfiles()));

        throw new ApplicationContextException("Database connection pool is not configured correctly");
    }
    HikariDataSource hikariDataSource =  (HikariDataSource) DataSourceBuilder
            .create(dataSourceProperties.getClassLoader())
            .type(HikariDataSource.class)
            .driverClassName(dataSourceProperties.getDriverClassName())
            .url(dataSourceProperties.getUrl())
            .username(dataSourceProperties.getUsername())
            .password(dataSourceProperties.getPassword())
            .build();

    if (metricRegistry != null) {
        hikariDataSource.setMetricRegistry(metricRegistry);
    }
    return hikariDataSource;
}
 
Example #5
Source File: DatabaseConfiguration.java    From OpenIoE with Apache License 2.0 6 votes vote down vote up
@Bean(destroyMethod = "close")
@ConditionalOnExpression("#{!environment.acceptsProfiles('" + Constants.SPRING_PROFILE_CLOUD + "') && !environment.acceptsProfiles('" + Constants.SPRING_PROFILE_HEROKU + "')}")
@ConfigurationProperties(prefix = "spring.datasource.hikari")
public DataSource dataSource(DataSourceProperties dataSourceProperties) {
    log.debug("Configuring Datasource");
    if (dataSourceProperties.getUrl() == null) {
        log.error("Your database connection pool configuration is incorrect! The application" +
                " cannot start. Please check your Spring profile, current profiles are: {}",
            Arrays.toString(env.getActiveProfiles()));

        throw new ApplicationContextException("Database connection pool is not configured correctly");
    }
    HikariDataSource hikariDataSource =  (HikariDataSource) DataSourceBuilder
            .create(dataSourceProperties.getClassLoader())
            .type(HikariDataSource.class)
            .driverClassName(dataSourceProperties.getDriverClassName())
            .url(dataSourceProperties.getUrl())
            .username(dataSourceProperties.getUsername())
            .password(dataSourceProperties.getPassword())
            .build();

    if (metricRegistry != null) {
        hikariDataSource.setMetricRegistry(metricRegistry);
    }
    return hikariDataSource;
}
 
Example #6
Source File: DatabaseConfiguration.java    From ServiceCutter with Apache License 2.0 6 votes vote down vote up
@Bean(destroyMethod = "close")
@ConditionalOnExpression("#{!environment.acceptsProfiles('cloud') && !environment.acceptsProfiles('heroku')}")
public DataSource dataSource() {
	log.debug("Configuring Datasource");
	if (dataSourcePropertyResolver.getProperty("url") == null && dataSourcePropertyResolver.getProperty("databaseName") == null) {
		log.error("Your database connection pool configuration is incorrect! The application" + " cannot start. Please check your Spring profile, current profiles are: {}",
				Arrays.toString(env.getActiveProfiles()));

		throw new ApplicationContextException("Database connection pool is not configured correctly");
	}
	HikariConfig config = new HikariConfig();
	config.setDataSourceClassName(dataSourcePropertyResolver.getProperty("dataSourceClassName"));
	if (StringUtils.isEmpty(dataSourcePropertyResolver.getProperty("url"))) {
		config.addDataSourceProperty("databaseName", dataSourcePropertyResolver.getProperty("databaseName"));
		config.addDataSourceProperty("serverName", dataSourcePropertyResolver.getProperty("serverName"));
	} else {
		config.addDataSourceProperty("url", dataSourcePropertyResolver.getProperty("url"));
	}
	config.addDataSourceProperty("user", dataSourcePropertyResolver.getProperty("username"));
	config.addDataSourceProperty("password", dataSourcePropertyResolver.getProperty("password"));

	if (metricRegistry != null) {
		config.setMetricRegistry(metricRegistry);
	}
	return new HikariDataSource(config);
}
 
Example #7
Source File: SwaggerConfig.java    From webanno with Apache License 2.0 6 votes vote down vote up
@ConditionalOnExpression("!(" + REMOTE_API_ENABLED_CONDITION + ")")
@Bean
public Docket defaultDocket()
{
    ApiSelectorBuilder builder = new Docket(DocumentationType.SWAGGER_2).select();
    builder.paths(path -> false);
    return builder.build()
            .groupName("Remote API disbled")
            .apiInfo(new ApiInfoBuilder()
                    .title("Remote API disabled")
                    .description(String.join(" ",
                            "The remote API is disabled."))
                    .license("")
                    .licenseUrl("")
            .build());
}
 
Example #8
Source File: SwaggerConfig.java    From webanno with Apache License 2.0 6 votes vote down vote up
@ConditionalOnExpression(REMOTE_API_ENABLED_CONDITION)
@Bean
public Docket areoRemoteApiDocket()
{
    ApiSelectorBuilder builder = new Docket(DocumentationType.SWAGGER_2).select();
    builder.paths(path -> path.matches(AeroRemoteApiController.API_BASE + "/.*"));
    return builder.build()
            .groupName("AERO API")
            .apiInfo(new ApiInfoBuilder()
                    .title("AERO")
                    .version("1.0.0") 
                    .description(String.join(" ",
                            "Annotation Editor Remote Operations API. ",
                            "https://openminted.github.io/releases/aero-spec/1.0.0/omtd-aero/"))
                    .license("Apache License 2.0")
                    .licenseUrl("https://www.apache.org/licenses/LICENSE-2.0.txt")
                    .build())
            .genericModelSubstitutes(Optional.class);
}
 
Example #9
Source File: CorsSupportConfiguration.java    From spring-backend-boilerplate with Apache License 2.0 6 votes vote down vote up
@Bean
@ConditionalOnExpression("${in.clouthink.daas.sbb.support.cors.enabled:true}")
@Autowired
public FilterRegistrationBean filterRegistrationBean(CorsSupportProperties corsSupportProperties) {
    final UrlBasedCorsConfigurationSource urlBasedCorsConfigurationSource = new UrlBasedCorsConfigurationSource();

    final CorsConfiguration corsConfiguration = new CorsConfiguration();
    corsConfiguration.setAllowCredentials(corsSupportProperties.isAllowCredentials());
    corsConfiguration.addAllowedOrigin(corsSupportProperties.getAllowOrigin());
    corsConfiguration.addAllowedHeader(corsSupportProperties.getAllowHeader());
    corsConfiguration.addAllowedMethod(corsSupportProperties.getAllowMethod());

    urlBasedCorsConfigurationSource.registerCorsConfiguration("/**", corsConfiguration);

    CorsFilter corsFilter = new CorsFilter(urlBasedCorsConfigurationSource);
    FilterRegistrationBean registration = new FilterRegistrationBean(corsFilter);
    registration.addUrlPatterns("/*");
    registration.setOrder(corsSupportProperties.getOrder());
    return registration;
}
 
Example #10
Source File: H2ServerConfiguration.java    From java-starthere with MIT License 5 votes vote down vote up
/**
 * TCP connection to connect with SQL clients to the embedded h2 database.
 * <p>
 * Connect to "jdbc:h2:tcp://localhost:9092/mem:testdb", username "sa", password empty.
 */
@Bean
@ConditionalOnExpression("${h2.tcp.enabled:true}")
public Server h2TcpServer() throws SQLException
{
    return Server.createTcpServer("-tcp",
                                  "-tcpAllowOthers",
                                  "-tcpPort",
                                  h2TcpPort)
                 .start();
}
 
Example #11
Source File: PrimefacesFileUploadServletContextAutoConfiguration.java    From joinfaces with Apache License 2.0 5 votes vote down vote up
/**
 * PrimefacesFileUploadServletContextInitializer for native uploader,
 * since {@link FileUploadFilter} suffices for commons file uploader.
 *
 * @param multipartConfigElement {@link MultipartAutoConfiguration#multipartConfigElement()}
 * @return primefaces file upload servlet context initializer
 */
@ConditionalOnExpression("'${joinfaces.primefaces.uploader}' != 'commons'")
@Bean
public ServletContextInitializer primefacesFileUploadServletContextInitializer(MultipartConfigElement multipartConfigElement) {
	return servletContext -> {
		ServletRegistration servletRegistration = servletContext.getServletRegistration(FACES_SERVLET_NAME);
		if (servletRegistration instanceof ServletRegistration.Dynamic) {
			((ServletRegistration.Dynamic) servletRegistration).setMultipartConfig(multipartConfigElement);
		}
	};
}
 
Example #12
Source File: UnrestrictedResourceConfig.java    From fiat with Apache License 2.0 5 votes vote down vote up
@Bean
@ConditionalOnExpression("${fiat.write-mode.enabled:true}")
String addUnrestrictedUser(PermissionsRepository permissionsRepository) {
  if (!permissionsRepository.get(UNRESTRICTED_USERNAME).isPresent()) {
    permissionsRepository.put(new UserPermission().setId(UNRESTRICTED_USERNAME));
  }
  return UNRESTRICTED_USERNAME;
}
 
Example #13
Source File: _DatabaseConfiguration.java    From jhipster-ribbon-hystrix with GNU General Public License v3.0 5 votes vote down vote up
@Bean(destroyMethod = "close")
    @ConditionalOnExpression("#{!environment.acceptsProfiles('" + Constants.SPRING_PROFILE_CLOUD + "') && !environment.acceptsProfiles('" + Constants.SPRING_PROFILE_HEROKU + "')}")
    @ConfigurationProperties(prefix = "spring.datasource.hikari")
    public DataSource dataSource(DataSourceProperties dataSourceProperties<% if (hibernateCache == 'hazelcast') { %>, CacheManager cacheManager<% } %>) {
        log.debug("Configuring Datasource");
        if (dataSourceProperties.getUrl() == null) {
            log.error("Your database connection pool configuration is incorrect! The application" +
                    " cannot start. Please check your Spring profile, current profiles are: {}",
                Arrays.toString(env.getActiveProfiles()));

            throw new ApplicationContextException("Database connection pool is not configured correctly");
        }
        HikariDataSource hikariDataSource =  (HikariDataSource) DataSourceBuilder
                .create(dataSourceProperties.getClassLoader())
                .type(HikariDataSource.class)
                .driverClassName(dataSourceProperties.getDriverClassName())
                .url(dataSourceProperties.getUrl())
                .username(dataSourceProperties.getUsername())
                .password(dataSourceProperties.getPassword())
                .build();

        if (metricRegistry != null) {
            hikariDataSource.setMetricRegistry(metricRegistry);
        }
        return hikariDataSource;
    }
<%_ if (devDatabaseType == 'h2Disk' || devDatabaseType == 'h2Memory') { _%>
 
Example #14
Source File: DatabaseConfiguration.java    From angularjs-springboot-bookstore with MIT License 5 votes vote down vote up
@Bean(destroyMethod = "shutdown")
@ConditionalOnExpression("#{!environment.acceptsProfiles('cloud') && !environment.acceptsProfiles('heroku')}")
public DataSource dataSource() {
    log.debug("Configuring Datasource");
    if (dataSourcePropertyResolver.getProperty("url") == null && dataSourcePropertyResolver.getProperty("databaseName") == null) {
        log.error("Your database connection pool configuration is incorrect! The application" +
                " cannot start. Please check your Spring profile, current profiles are: {}",
                Arrays.toString(env.getActiveProfiles()));

        throw new ApplicationContextException("Database connection pool is not configured correctly");
    }
    HikariConfig config = new HikariConfig();
    config.setDataSourceClassName(dataSourcePropertyResolver.getProperty("dataSourceClassName"));
    if(StringUtils.isEmpty(dataSourcePropertyResolver.getProperty("url"))) {
        config.addDataSourceProperty("databaseName", dataSourcePropertyResolver.getProperty("databaseName"));
        config.addDataSourceProperty("serverName", dataSourcePropertyResolver.getProperty("serverName"));
    } else {
        config.addDataSourceProperty("url", dataSourcePropertyResolver.getProperty("url"));
    }
    config.addDataSourceProperty("user", dataSourcePropertyResolver.getProperty("username"));
    config.addDataSourceProperty("password", dataSourcePropertyResolver.getProperty("password"));

    if (metricRegistry != null) {
        config.setMetricRegistry(metricRegistry);
    }
    return new HikariDataSource(config);
}
 
Example #15
Source File: SwaggerConfig.java    From webanno with Apache License 2.0 5 votes vote down vote up
@ConditionalOnExpression(REMOTE_API_ENABLED_CONDITION)
@Bean
public Docket legacyRemoteApiDocket()
{
    ApiSelectorBuilder builder = new Docket(DocumentationType.SWAGGER_2).select();
    builder.paths(path -> path.matches(LegacyRemoteApiController.API_BASE + "/.*"));
    return builder.build()
            .groupName("Legacy API")
            .genericModelSubstitutes(Optional.class);
}
 
Example #16
Source File: HealthCheckerConfiguration.java    From prebid-server-java with Apache License 2.0 5 votes vote down vote up
@Bean
@ConditionalOnExpression("${health-check.geolocation.enabled} == true and ${geolocation.enabled} == true")
HealthChecker geoLocationChecker(Vertx vertx,
                                 @Value("${health-check.geolocation.refresh-period-ms}") long refreshPeriod,
                                 GeoLocationService geoLocationService,
                                 TimeoutFactory timeoutFactory,
                                 Clock clock) {

    return new GeoLocationHealthChecker(vertx, refreshPeriod, geoLocationService, timeoutFactory, clock);
}
 
Example #17
Source File: DatabaseConfiguration.java    From expper with GNU General Public License v3.0 5 votes vote down vote up
@Bean(destroyMethod = "close")
@ConditionalOnExpression("#{!environment.acceptsProfiles('cloud') && !environment.acceptsProfiles('heroku')}")
public DataSource dataSource(DataSourceProperties dataSourceProperties, JHipsterProperties jHipsterProperties) {
    log.debug("Configuring Datasource");
    if (dataSourceProperties.getUrl() == null) {
        log.error("Your database connection pool configuration is incorrect! The application" +
                " cannot start. Please check your Spring profile, current profiles are: {}",
            Arrays.toString(env.getActiveProfiles()));

        throw new ApplicationContextException("Database connection pool is not configured correctly");
    }
    HikariConfig config = new HikariConfig();
    config.setDataSourceClassName(dataSourceProperties.getDriverClassName());
    config.addDataSourceProperty("url", dataSourceProperties.getUrl());
    if (dataSourceProperties.getUsername() != null) {
        config.addDataSourceProperty("user", dataSourceProperties.getUsername());
    } else {
        config.addDataSourceProperty("user", ""); // HikariCP doesn't allow null user
    }
    if (dataSourceProperties.getPassword() != null) {
        config.addDataSourceProperty("password", dataSourceProperties.getPassword());
    } else {
        config.addDataSourceProperty("password", ""); // HikariCP doesn't allow null password
    }

    if (metricRegistry != null) {
        config.setMetricRegistry(metricRegistry);
    }
    return new HikariDataSource(config);
}
 
Example #18
Source File: ZookeeperKeymasterClientContext.java    From syncope with Apache License 2.0 5 votes vote down vote up
@ConditionalOnExpression("#{'${keymaster.address}' "
        + "matches '^((\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})|[a-z\\.]+):[0-9]+$'}")
@Bean
public ServiceOps serviceOps() {
    return new ZookeeperServiceDiscoveryOps();
    //return new ZookeeperServiceOps();
}
 
Example #19
Source File: SelfKeymasterClientContext.java    From syncope with Apache License 2.0 5 votes vote down vote up
@ConditionalOnExpression("#{'${keymaster.address}' matches '^http.+'}")
@Bean
@ConditionalOnMissingBean(name = "selfKeymasterRESTClientFactoryBean")
public JAXRSClientFactoryBean selfKeymasterRESTClientFactoryBean() {
    JAXRSClientFactoryBean restClientFactoryBean = new JAXRSClientFactoryBean();
    restClientFactoryBean.setAddress(address);
    restClientFactoryBean.setUsername(username);
    restClientFactoryBean.setPassword(password);
    restClientFactoryBean.setThreadSafe(true);
    restClientFactoryBean.setInheritHeaders(true);
    restClientFactoryBean.setFeatures(List.of(new LoggingFeature()));
    restClientFactoryBean.setProviders(
        List.of(new JacksonJsonProvider(), new SelfKeymasterClientExceptionMapper()));
    return restClientFactoryBean;
}
 
Example #20
Source File: BootstrapConfiguration.java    From chronus with Apache License 2.0 5 votes vote down vote up
@Order(100)
@Bean(name = "support#Bootstrap")
@ConditionalOnExpression("${chronus.executor.enabled:true} || ${chronus.master.enabled:true}")
public BootstrapSupport bootstrapSupport() {
    BootstrapSupport bootstrap = new BootstrapSupport();
    return bootstrap;
}
 
Example #21
Source File: H2ServerConfiguration.java    From java-starthere with MIT License 5 votes vote down vote up
/**
 * Web console for the embedded h2 database.
 * <p>
 * Go to http://localhost:8082 and connect to the database "jdbc:h2:mem:testdb", username "sa", password empty.
 */
@Bean
@ConditionalOnExpression("${h2.web.enabled:true}")
public Server h2WebServer() throws SQLException
{
    return Server.createWebServer("-web",
                                  "-webAllowOthers",
                                  "-webPort",
                                  h2WebPort)
                 .start();
}
 
Example #22
Source File: RemoteApiConfig.java    From webanno with Apache License 2.0 4 votes vote down vote up
@ConditionalOnExpression(REMOTE_API_ENABLED_CONDITION)
@Bean
public AeroRemoteApiController aeroRemoteApiController()
{
    return new AeroRemoteApiController();
}
 
Example #23
Source File: RemoteApiConfig.java    From webanno with Apache License 2.0 4 votes vote down vote up
@ConditionalOnExpression(REMOTE_API_ENABLED_CONDITION)
@Bean
public LegacyRemoteApiController legacyRemoteApiController()
{
    return new LegacyRemoteApiController();
}
 
Example #24
Source File: ZookeeperKeymasterClientContext.java    From syncope with Apache License 2.0 4 votes vote down vote up
@ConditionalOnExpression("#{'${keymaster.address}' "
        + "matches '^((\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})|[a-z\\.]+):[0-9]+$'}")
@Bean
public CuratorFramework curatorFramework() throws InterruptedException {
    if (StringUtils.isNotBlank(username) && StringUtils.isNotBlank(password)) {
        javax.security.auth.login.Configuration.setConfiguration(new javax.security.auth.login.Configuration() {

            private final AppConfigurationEntry[] entries = {
                new AppConfigurationEntry(
                DigestLoginModule.class.getName(),
                AppConfigurationEntry.LoginModuleControlFlag.REQUIRED,
                Map.of(
                "username", username,
                "password", password
                ))
            };

            @Override
            public AppConfigurationEntry[] getAppConfigurationEntry(final String name) {
                return entries;
            }
        });
    }

    CuratorFrameworkFactory.Builder clientBuilder = CuratorFrameworkFactory.builder().
            connectString(address).
            retryPolicy(new ExponentialBackoffRetry(baseSleepTimeMs, maxRetries));
    if (StringUtils.isNotBlank(username)) {
        clientBuilder.authorization("digest", username.getBytes()).aclProvider(new ACLProvider() {

            @Override
            public List<ACL> getDefaultAcl() {
                return ZooDefs.Ids.CREATOR_ALL_ACL;
            }

            @Override
            public List<ACL> getAclForPath(final String path) {
                return ZooDefs.Ids.CREATOR_ALL_ACL;
            }
        });
    }
    CuratorFramework client = clientBuilder.build();
    client.start();
    client.blockUntilConnected(3, TimeUnit.SECONDS);

    return client;
}
 
Example #25
Source File: EmailEmbeddedRedisConfiguration.java    From spring-boot-email-tools with Apache License 2.0 4 votes vote down vote up
@Bean
@ConditionalOnExpression(PERSISTENCE_IS_ENABLED_WITH_EMBEDDED_REDIS)
public EmailEmbeddedRedis emailEmbeddedRedis() {
    return emailEmbeddedRedis;
}
 
Example #26
Source File: ZookeeperKeymasterClientContext.java    From syncope with Apache License 2.0 4 votes vote down vote up
@ConditionalOnExpression("#{'${keymaster.address}' "
        + "matches '^((\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})|[a-z\\.]+):[0-9]+$'}")
@Bean
public ConfParamOps selfConfParamOps() {
    return new ZookeeperConfParamOps();
}
 
Example #27
Source File: ZookeeperKeymasterClientContext.java    From syncope with Apache License 2.0 4 votes vote down vote up
@ConditionalOnExpression("#{'${keymaster.address}' "
        + "matches '^((\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})|[a-z\\.]+):[0-9]+$'}")
@Bean
public DomainOps domainOps() {
    return new ZookeeperDomainOps();
}
 
Example #28
Source File: SelfKeymasterClientContext.java    From syncope with Apache License 2.0 4 votes vote down vote up
@ConditionalOnExpression("#{'${keymaster.address}' matches '^http.+'}")
@Bean
@ConditionalOnMissingBean(name = "selfConfParamOps")
public ConfParamOps selfConfParamOps() {
    return new SelfKeymasterConfParamOps(selfKeymasterRESTClientFactoryBean());
}
 
Example #29
Source File: SelfKeymasterClientContext.java    From syncope with Apache License 2.0 4 votes vote down vote up
@ConditionalOnExpression("#{'${keymaster.address}' matches '^http.+'}")
@Bean
@ConditionalOnMissingBean(name = "selfServiceOps")
public ServiceOps selfServiceOps() {
    return new SelfKeymasterServiceOps(selfKeymasterRESTClientFactoryBean(), 5);
}
 
Example #30
Source File: RSocketBrokerAutoConfiguration.java    From alibaba-rsocket-broker with Apache License 2.0 4 votes vote down vote up
@Bean
@ConditionalOnExpression("'${rsocket.broker.topology}'=='gossip'")
@Primary
public RSocketBrokerManager rsocketGossipBrokerManager() {
    return new RSocketBrokerManagerGossipImpl();
}