/** * (基于内存的)用户授权信息Cache */ @Bean(name = "cacheManager") @ConditionalOnMissingBean(name = "cacheManager") @ConditionalOnMissingClass(value = {"org.apache.shiro.cache.ehcache.EhCacheManager"}) public CacheManager cacheManager() { return new MemoryConstrainedCacheManager(); }
@Bean(destroyMethod = "shutdown") @ConditionalOnMissingClass(name = "es.cesga.hadoop.config.HerokuDatabaseConfiguration") @Profile("!" + Constants.SPRING_PROFILE_CLOUD) public DataSource dataSource() { log.debug("Configuring Datasource"); if (propertyResolver.getProperty("url") == null && propertyResolver.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(propertyResolver.getProperty("dataSourceClassName")); if(StringUtils.isEmpty(propertyResolver.getProperty("url"))) { config.addDataSourceProperty("databaseName", propertyResolver.getProperty("databaseName")); config.addDataSourceProperty("serverName", propertyResolver.getProperty("serverName")); } else { config.addDataSourceProperty("url", propertyResolver.getProperty("url")); } config.addDataSourceProperty("user", propertyResolver.getProperty("username")); config.addDataSourceProperty("password", propertyResolver.getProperty("password")); //MySQL optimizations, see https://github.com/brettwooldridge/HikariCP/wiki/MySQL-Configuration if ("com.mysql.jdbc.jdbc2.optional.MysqlDataSource".equals(propertyResolver.getProperty("dataSourceClassName"))) { config.addDataSourceProperty("cachePrepStmts", propertyResolver.getProperty("cachePrepStmts", "true")); config.addDataSourceProperty("prepStmtCacheSize", propertyResolver.getProperty("prepStmtCacheSize", "250")); config.addDataSourceProperty("prepStmtCacheSqlLimit", propertyResolver.getProperty("prepStmtCacheSqlLimit", "2048")); config.addDataSourceProperty("useServerPrepStmts", propertyResolver.getProperty("useServerPrepStmts", "true")); } if (metricRegistry != null) { config.setMetricRegistry(metricRegistry); } return new HikariDataSource(config); }
@Bean(destroyMethod = "shutdown") @ConditionalOnMissingClass(name = "de.kumpelblase2.jhipsterwebsocket.config.HerokuDatabaseConfiguration") @Profile("!" + Constants.SPRING_PROFILE_CLOUD) public DataSource dataSource() { log.debug("Configuring Datasource"); if (propertyResolver.getProperty("url") == null && propertyResolver.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(propertyResolver.getProperty("dataSourceClassName")); if (propertyResolver.getProperty("url") == null || "".equals(propertyResolver.getProperty("url"))) { config.addDataSourceProperty("databaseName", propertyResolver.getProperty("databaseName")); config.addDataSourceProperty("serverName", propertyResolver.getProperty("serverName")); } else { config.addDataSourceProperty("url", propertyResolver.getProperty("url")); } config.addDataSourceProperty("user", propertyResolver.getProperty("username")); config.addDataSourceProperty("password", propertyResolver.getProperty("password")); //MySQL optimizations, see https://github.com/brettwooldridge/HikariCP/wiki/MySQL-Configuration if ("com.mysql.jdbc.jdbc2.optional.MysqlDataSource".equals(propertyResolver.getProperty("dataSourceClassName"))) { config.addDataSourceProperty("cachePrepStmts", propertyResolver.getProperty("cachePrepStmts", "true")); config.addDataSourceProperty("prepStmtCacheSize", propertyResolver.getProperty("prepStmtCacheSize", "250")); config.addDataSourceProperty("prepStmtCacheSqlLimit", propertyResolver.getProperty("prepStmtCacheSqlLimit", "2048")); config.addDataSourceProperty("useServerPrepStmts", propertyResolver.getProperty("useServerPrepStmts", "true")); } if (metricRegistry != null) { config.setMetricRegistry(metricRegistry); } return new HikariDataSource(config); }
@Bean(destroyMethod = "shutdown") @ConditionalOnMissingClass(name = "com.jittrack.gts.config.HerokuDatabaseConfiguration") @Profile("!" + Constants.SPRING_PROFILE_CLOUD) public DataSource dataSource() { log.debug("Configuring Datasource"); if (propertyResolver.getProperty("url") == null && propertyResolver.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(propertyResolver.getProperty("dataSourceClassName")); if (propertyResolver.getProperty("url") == null || "".equals(propertyResolver.getProperty("url"))) { config.addDataSourceProperty("databaseName", propertyResolver.getProperty("databaseName")); config.addDataSourceProperty("serverName", propertyResolver.getProperty("serverName")); } else { config.addDataSourceProperty("url", propertyResolver.getProperty("url")); } config.addDataSourceProperty("user", propertyResolver.getProperty("username")); config.addDataSourceProperty("password", propertyResolver.getProperty("password")); //MySQL optimizations, see https://github.com/brettwooldridge/HikariCP/wiki/MySQL-Configuration if ("com.mysql.jdbc.jdbc2.optional.MysqlDataSource".equals(propertyResolver.getProperty("dataSourceClassName"))) { config.addDataSourceProperty("cachePrepStmts", propertyResolver.getProperty("cachePrepStmts", "true")); config.addDataSourceProperty("prepStmtCacheSize", propertyResolver.getProperty("prepStmtCacheSize", "250")); config.addDataSourceProperty("prepStmtCacheSqlLimit", propertyResolver.getProperty("prepStmtCacheSqlLimit", "2048")); config.addDataSourceProperty("useServerPrepStmts", propertyResolver.getProperty("useServerPrepStmts", "true")); } if (metricRegistry != null) { config.setMetricRegistry(metricRegistry); } return new HikariDataSource(config); }
@Bean(destroyMethod = "shutdown") @ConditionalOnMissingClass(name = "com.miagebdx.website.config.HerokuDatabaseConfiguration") @Profile("!" + Constants.SPRING_PROFILE_CLOUD) public DataSource dataSource() { log.debug("Configuring Datasource"); if (propertyResolver.getProperty("url") == null && propertyResolver.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(propertyResolver.getProperty("dataSourceClassName")); if (propertyResolver.getProperty("url") == null || "".equals(propertyResolver.getProperty("url"))) { config.addDataSourceProperty("databaseName", propertyResolver.getProperty("databaseName")); config.addDataSourceProperty("serverName", propertyResolver.getProperty("serverName")); } else { config.addDataSourceProperty("url", propertyResolver.getProperty("url")); } config.addDataSourceProperty("user", propertyResolver.getProperty("username")); config.addDataSourceProperty("password", propertyResolver.getProperty("password")); //MySQL optimizations, see https://github.com/brettwooldridge/HikariCP/wiki/MySQL-Configuration if ("com.mysql.jdbc.jdbc2.optional.MysqlDataSource".equals(propertyResolver.getProperty("dataSourceClassName"))) { config.addDataSourceProperty("cachePrepStmts", propertyResolver.getProperty("cachePrepStmts", "true")); config.addDataSourceProperty("prepStmtCacheSize", propertyResolver.getProperty("prepStmtCacheSize", "250")); config.addDataSourceProperty("prepStmtCacheSqlLimit", propertyResolver.getProperty("prepStmtCacheSqlLimit", "2048")); config.addDataSourceProperty("useServerPrepStmts", propertyResolver.getProperty("useServerPrepStmts", "true")); } if (metricRegistry != null) { config.setMetricRegistry(metricRegistry); } return new HikariDataSource(config); }
@Bean(destroyMethod = "shutdown") @ConditionalOnMissingClass(name = "com.tomkasp.config.HerokuDatabaseConfiguration") @Profile("!" + Constants.SPRING_PROFILE_CLOUD) public DataSource dataSource() { log.debug("Configuring Datasource"); if (propertyResolver.getProperty("url") == null && propertyResolver.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(propertyResolver.getProperty("dataSourceClassName")); if(StringUtils.isEmpty(propertyResolver.getProperty("url"))) { config.addDataSourceProperty("databaseName", propertyResolver.getProperty("databaseName")); config.addDataSourceProperty("serverName", propertyResolver.getProperty("serverName")); } else { config.addDataSourceProperty("url", propertyResolver.getProperty("url")); } config.addDataSourceProperty("user", propertyResolver.getProperty("username")); config.addDataSourceProperty("password", propertyResolver.getProperty("password")); if (metricRegistry != null) { config.setMetricRegistry(metricRegistry); } return new HikariDataSource(config); }
@Bean(destroyMethod = "close") @ConditionalOnMissingClass("fr.lpr.membership.config.HerokuDatabaseConfiguration") @Profile("!" + Constants.SPRING_PROFILE_CLOUD) 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); }
@Bean(destroyMethod = "shutdown") @ConditionalOnMissingClass(name = "com.jquaternion.jqsa.config.HerokuDatabaseConfiguration.class") public DataSource dataSource() { log.debug("Configuring Datasource"); if (propertyResolver.getProperty("url") == null && propertyResolver.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(environment.getActiveProfiles())); throw new ApplicationContextException("Database connection pool is not configured correctly"); } HikariConfig config = new HikariConfig(); config.setDataSourceClassName(propertyResolver.getProperty("dataSourceClassName")); if (propertyResolver.getProperty("url") == null || "".equals(propertyResolver.getProperty("url"))) { config.addDataSourceProperty("databaseName", propertyResolver.getProperty("databaseName")); config.addDataSourceProperty("serverName", propertyResolver.getProperty("serverName")); } else { config.addDataSourceProperty("url", propertyResolver.getProperty("url")); } config.addDataSourceProperty("user", propertyResolver.getProperty("username")); config.addDataSourceProperty("password", propertyResolver.getProperty("password")); //MySQL optimizations, see https://github.com/brettwooldridge/HikariCP/wiki/MySQL-Configuration if ("com.mysql.jdbc.jdbc2.optional.MysqlDataSource".equals(propertyResolver.getProperty("dataSourceClassName"))) { config.addDataSourceProperty("cachePrepStmts", propertyResolver.getProperty("cachePrepStmts", "true")); config.addDataSourceProperty("prepStmtCacheSize", propertyResolver.getProperty("prepStmtCacheSize", "250")); config.addDataSourceProperty("prepStmtCacheSqlLimit", propertyResolver.getProperty("prepStmtCacheSqlLimit", "2048")); config.addDataSourceProperty("useServerPrepStmts", propertyResolver.getProperty("useServerPrepStmts", "true")); } return new HikariDataSource(config); }
@Bean @Primary @ConditionalOnMissingClass("org.springframework.messaging.MessageChannel") @ConditionalOnMissingBean(name = "primaryMetricWriter") public MetricWriter primaryMetricWriter(List<MetricWriter> writers) { return new CompositeMetricWriter(writers); }
@Bean(destroyMethod = "shutdown") @ConditionalOnMissingClass(name = "org.iobrew.config.HerokuDatabaseConfiguration") @Profile("!cloud") public DataSource dataSource(MetricRegistry metricRegistry) { log.debug("Configuring Datasource"); if (propertyResolver.getProperty("url") == null && propertyResolver.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(environment.getActiveProfiles())); throw new ApplicationContextException("Database connection pool is not configured correctly"); } HikariConfig config = new HikariConfig(); config.setDataSourceClassName(propertyResolver.getProperty("dataSourceClassName")); if (propertyResolver.getProperty("url") == null || "".equals(propertyResolver.getProperty("url"))) { config.addDataSourceProperty("databaseName", propertyResolver.getProperty("databaseName")); config.addDataSourceProperty("serverName", propertyResolver.getProperty("serverName")); } else { config.addDataSourceProperty("url", propertyResolver.getProperty("url")); } config.addDataSourceProperty("user", propertyResolver.getProperty("username")); config.addDataSourceProperty("password", propertyResolver.getProperty("password")); //MySQL optimizations, see https://github.com/brettwooldridge/HikariCP/wiki/MySQL-Configuration if ("com.mysql.jdbc.jdbc2.optional.MysqlDataSource".equals(propertyResolver.getProperty("dataSourceClassName"))) { config.addDataSourceProperty("cachePrepStmts", propertyResolver.getProperty("cachePrepStmts", "true")); config.addDataSourceProperty("prepStmtCacheSize", propertyResolver.getProperty("prepStmtCacheSize", "250")); config.addDataSourceProperty("prepStmtCacheSqlLimit", propertyResolver.getProperty("prepStmtCacheSqlLimit", "2048")); config.addDataSourceProperty("useServerPrepStmts", propertyResolver.getProperty("useServerPrepStmts", "true")); } config.setMetricRegistry(metricRegistry); return new HikariDataSource(config); }
@Bean(destroyMethod = "shutdown") @ConditionalOnMissingClass(name = "ch.alv.sysinfos.config.HerokuDatabaseConfiguration") @Profile("!" + Constants.SPRING_PROFILE_CLOUD) public DataSource dataSource() { log.debug("Configuring Datasource"); if (propertyResolver.getProperty("url") == null && propertyResolver.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(propertyResolver.getProperty("dataSourceClassName")); if (propertyResolver.getProperty("url") == null || "".equals(propertyResolver.getProperty("url"))) { config.addDataSourceProperty("databaseName", propertyResolver.getProperty("databaseName")); config.addDataSourceProperty("serverName", propertyResolver.getProperty("serverName")); } else { config.addDataSourceProperty("url", propertyResolver.getProperty("url")); } config.addDataSourceProperty("user", propertyResolver.getProperty("username")); config.addDataSourceProperty("password", propertyResolver.getProperty("password")); //MySQL optimizations, see https://github.com/brettwooldridge/HikariCP/wiki/MySQL-Configuration if ("com.mysql.jdbc.jdbc2.optional.MysqlDataSource".equals(propertyResolver.getProperty("dataSourceClassName"))) { config.addDataSourceProperty("cachePrepStmts", propertyResolver.getProperty("cachePrepStmts", "true")); config.addDataSourceProperty("prepStmtCacheSize", propertyResolver.getProperty("prepStmtCacheSize", "250")); config.addDataSourceProperty("prepStmtCacheSqlLimit", propertyResolver.getProperty("prepStmtCacheSqlLimit", "2048")); config.addDataSourceProperty("useServerPrepStmts", propertyResolver.getProperty("useServerPrepStmts", "true")); } if (metricRegistry != null) { config.setMetricRegistry(metricRegistry); } return new HikariDataSource(config); }
@Bean(destroyMethod = "shutdown") @ConditionalOnMissingClass(name = "de.rwth.idsg.bikeman.config.HerokuDatabaseConfiguration") @Profile("!" + Constants.SPRING_PROFILE_CLOUD) public DataSource dataSource() { log.debug("Configuring Datasource"); if (propertyResolver.getProperty("url") == null && propertyResolver.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(propertyResolver.getProperty("dataSourceClassName")); if (propertyResolver.getProperty("url") == null || "".equals(propertyResolver.getProperty("url"))) { config.addDataSourceProperty("databaseName", propertyResolver.getProperty("databaseName")); config.addDataSourceProperty("serverName", propertyResolver.getProperty("serverName")); } else { config.addDataSourceProperty("url", propertyResolver.getProperty("url")); } config.addDataSourceProperty("user", propertyResolver.getProperty("username")); config.addDataSourceProperty("password", propertyResolver.getProperty("password")); if (metricRegistry != null) { config.setMetricRegistry(metricRegistry); } return new HikariDataSource(config); }
@Bean @ConditionalOnMissingBean(AbstractLoadBalancerAwareClient.class) @ConditionalOnMissingClass(value = "org.springframework.retry.support.RetryTemplate") public OkHttpLoadBalancingClient retryableOkHttpLoadBalancingClient( IClientConfig config, ServerIntrospector serverIntrospector, ILoadBalancer loadBalancer, RetryHandler retryHandler, OkHttpClient delegate) { OkHttpLoadBalancingClient client = new OkHttpLoadBalancingClient(delegate, config, serverIntrospector); client.setLoadBalancer(loadBalancer); client.setRetryHandler(retryHandler); Monitors.registerObject("Client_" + this.name, client); return client; }
@Bean @ConditionalOnMissingBean(AbstractLoadBalancerAwareClient.class) @ConditionalOnMissingClass(value = "org.springframework.retry.support.RetryTemplate") public RibbonLoadBalancingHttpClient ribbonLoadBalancingHttpClient( IClientConfig config, ServerIntrospector serverIntrospector, ILoadBalancer loadBalancer, RetryHandler retryHandler, CloseableHttpClient httpClient) { RibbonLoadBalancingHttpClient client = new RibbonLoadBalancingHttpClient(httpClient, config, serverIntrospector); client.setLoadBalancer(loadBalancer); client.setRetryHandler(retryHandler); Monitors.registerObject("Client_" + this.name, client); return client; }
@Bean @Primary @ConditionalOnMissingClass("org.springframework.retry.support.RetryTemplate") public CachingSpringLoadBalancerFactory cachingLBClientFactory( SpringClientFactory factory) { return new CachingSpringLoadBalancerFactory(factory); }
@Bean(name = "dataSourcePropertiesInitializer") @ConditionalOnMissingClass({ "com.ulisesbocchio.jasyptspringboot.wrapper.EncryptablePropertySourceWrapper", "org.jasypt.encryption.StringEncryptor" }) @ConditionalOnMissingBean public DataSourcePropertiesInitializer dataSourcePropertiesInitializer(@Named("databaseConfiguration") DaoConfigurationPropertiesFactoryBean databaseConfigFactory) { return new DataSourcePropertiesInitializer(databaseConfigFactory); }
@Bean @ConditionalOnMissingClass("org.zalando.tracer.Tracer") @ConditionalOnMissingBean(FlowIdComponent.class) public FlowIdComponent flowIdComponent() { return new NoopFlowIdComponent(); }
@Bean @ConditionalOnMissingBean @ConditionalOnMissingClass({"org.springframework.security.access.AccessDeniedException", "org.springframework.security.core.AuthenticationException"}) public ErrorDataProviderContext errorDataProviderContext() { return new ErrorDataProviderContext(errorestProperties); }
@Bean @ConditionalOnMissingBean(JestClient.class) @ConditionalOnMissingClass("org.elasticsearch.node.Node") public JestClient client() { return createJestClient(properties.getUri()); }
@Bean @ConditionalOnMissingClass("org.springframework.boot.actuate.autoconfigure.ManagementServerProperties") @ConditionalOnMissingBean(SkipPatternProvider.class) public SkipPatternProvider defaultSkipPatternBean() { return defaultSkipPatternProvider(this.skipPattern); }
@Bean @ConditionalOnMissingClass("org.slf4j.MDC") @ConditionalOnMissingBean public SpanLogger defaultLoggedSpansHandler() { return new NoOpSpanLogger(); }
@Bean @ConditionalOnMissingClass("org.springframework.boot.actuate.metrics.CounterService") @ConditionalOnMissingBean(SpanMetricReporter.class) public SpanMetricReporter noOpSpanReporterCounterService() { return new NoOpSpanMetricReporter(); }
@Bean @ConditionalOnMissingClass("org.springframework.boot.actuate.autoconfigure.ManagementServerProperties") @ConditionalOnMissingBean(SkipPatternProvider.class) public SkipPatternProvider defaultSkipPatternBean(SleuthWebProperties sleuthWebProperties) { return defaultSkipPatternProvider(sleuthWebProperties.getSkipPattern()); }
@Bean @ConditionalOnMissingClass("io.micrometer.core.instrument.MeterRegistry") @ConditionalOnMissingBean(SpanMetricReporter.class) public SpanMetricReporter noOpSpanReporterCounterService() { return new NoOpSpanMetricReporter(); }
@Bean(destroyMethod = "shutdown") @ConditionalOnMissingClass(name = "it.cineca.pst.huborcid.config.HerokuDatabaseConfiguration") @Profile("!" + Constants.SPRING_PROFILE_CLOUD) 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(); if(StringUtils.isEmpty(dataSourcePropertyResolver.getProperty("jndi"))){ 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")); config.setConnectionTimeout(10000); config.setMaximumPoolSize(25); }else{ final JndiDataSourceLookup dataSourceLookup = new JndiDataSourceLookup(); dataSourceLookup.setResourceRef(true); DataSource dataSourceTemp = null; try { dataSourceTemp = dataSourceLookup.getDataSource(dataSourcePropertyResolver.getProperty("jndi")); } catch (DataSourceLookupFailureException e) { log.error("DataSource not found."); } config.setDataSource(dataSourceTemp); } if (metricRegistry != null) { config.setMetricRegistry(metricRegistry); } return new HikariDataSource(config); }
@Bean @ConditionalOnMissingClass(value = "org.springframework.retry.support.RetryTemplate") @ConditionalOnMissingBean public LoadBalancedRetryPolicyFactory neverRetryPolicyFactory() { return new LoadBalancedRetryPolicyFactory.NeverRetryFactory(); }
@Bean @ConditionalOnMissingClass("com.sun.jersey.api.client.filter.ClientFilter") @ConditionalOnMissingBean(value = AbstractDiscoveryClientOptionalArgs.class, search = SearchStrategy.CURRENT) public RestTemplateDiscoveryClientOptionalArgs restTemplateDiscoveryClientOptionalArgs() { return new RestTemplateDiscoveryClientOptionalArgs(); }
@Bean @ConditionalOnMissingClass("org.springframework.cloud.aws.mail.simplemail.SimpleEmailServiceJavaMailSender") public MailSender simpleMailSender(AmazonSimpleEmailService amazonSimpleEmailService) { return new SimpleEmailServiceMailSender(amazonSimpleEmailService); }
@Bean(name = "authorProvider") @ConditionalOnMissingBean @ConditionalOnMissingClass({"org.springframework.security.core.context.SecurityContextHolder"}) public AuthorProvider unknownAuthorProvider() { return new MockAuthorProvider(); }