Java Code Examples for org.springframework.boot.autoconfigure.condition.SearchStrategy#CURRENT
The following examples show how to use
org.springframework.boot.autoconfigure.condition.SearchStrategy#CURRENT .
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: EurekaClientAutoConfigurationTests.java From spring-cloud-netflix with Apache License 2.0 | 6 votes |
@Bean(destroyMethod = "shutdown") @ConditionalOnMissingBean(value = EurekaClient.class, search = SearchStrategy.CURRENT) public EurekaClient eurekaClient(ApplicationInfoManager manager, EurekaClientConfig config, ApplicationContext context) { return new CloudEurekaClient(manager, config, null, context) { @Override public synchronized void shutdown() { CountDownLatch latch = countDownLatch(); if (latch.getCount() == 1) { latch.countDown(); } super.shutdown(); } }; }
Example 2
Source File: DiscoveryClientOptionalArgsConfiguration.java From spring-cloud-netflix with Apache License 2.0 | 5 votes |
@Bean @ConditionalOnClass(name = "com.sun.jersey.api.client.filter.ClientFilter") @ConditionalOnMissingBean(value = AbstractDiscoveryClientOptionalArgs.class, search = SearchStrategy.CURRENT) public MutableDiscoveryClientOptionalArgs discoveryClientOptionalArgs() { logger.info("Eureka Client uses Jersey"); return new MutableDiscoveryClientOptionalArgs(); }
Example 3
Source File: BrpcServiceRegistrationAutoConfiguration.java From brpc-java with Apache License 2.0 | 5 votes |
@Bean @ConditionalOnMissingBean(value = EurekaInstanceConfig.class, search = SearchStrategy.CURRENT) public EurekaInstanceConfigBean eurekaInstanceConfigBean( InetUtils inetUtils, ManagementMetadataProvider managementMetadataProvider) { EurekaInstanceConfigBean instance = new EurekaClientAutoConfiguration(env) .eurekaInstanceConfigBean(inetUtils, managementMetadataProvider); String brpcPort = env.getProperty(ENV_PORT_KEY); if (StringUtils.isNoneBlank(brpcPort)) { instance.getMetadataMap().put(META_DATA_PORT_KEY, brpcPort); } return instance; }
Example 4
Source File: EurekaClientAutoConfiguration.java From spring-cloud-netflix with Apache License 2.0 | 5 votes |
@Bean @ConditionalOnMissingBean(value = ApplicationInfoManager.class, search = SearchStrategy.CURRENT) public ApplicationInfoManager eurekaApplicationInfoManager( EurekaInstanceConfig config) { InstanceInfo instanceInfo = new InstanceInfoFactory().create(config); return new ApplicationInfoManager(config, instanceInfo); }
Example 5
Source File: EurekaClientAutoConfiguration.java From spring-cloud-netflix with Apache License 2.0 | 5 votes |
@Bean(destroyMethod = "shutdown") @ConditionalOnMissingBean(value = EurekaClient.class, search = SearchStrategy.CURRENT) public EurekaClient eurekaClient(ApplicationInfoManager manager, EurekaClientConfig config) { return new CloudEurekaClient(manager, config, this.optionalArgs, this.context); }
Example 6
Source File: DiscoveryClientOptionalArgsConfiguration.java From spring-cloud-netflix with Apache License 2.0 | 5 votes |
@Bean @ConditionalOnClass(name = "org.springframework.web.client.RestTemplate") @ConditionalOnMissingClass("com.sun.jersey.api.client.filter.ClientFilter") @ConditionalOnMissingBean(value = { AbstractDiscoveryClientOptionalArgs.class }, search = SearchStrategy.CURRENT) @ConditionalOnProperty(prefix = "eureka.client", name = "webclient.enabled", matchIfMissing = true, havingValue = "false") public RestTemplateDiscoveryClientOptionalArgs restTemplateDiscoveryClientOptionalArgs() { logger.info("Eureka HTTP Client uses RestTemplate."); return new RestTemplateDiscoveryClientOptionalArgs(); }
Example 7
Source File: ConfigurationPropertiesRebinderAutoConfiguration.java From spring-cloud-commons with Apache License 2.0 | 5 votes |
@Bean @ConditionalOnMissingBean(search = SearchStrategy.CURRENT) public ConfigurationPropertiesRebinder configurationPropertiesRebinder( ConfigurationPropertiesBeans beans) { ConfigurationPropertiesRebinder rebinder = new ConfigurationPropertiesRebinder( beans); return rebinder; }
Example 8
Source File: BindingServiceConfiguration.java From spring-cloud-stream with Apache License 2.0 | 5 votes |
@Bean // This conditional is intentionally not in an autoconfig (usually a bad idea) because // it is used to detect a BindingService in the parent context (which we know // already exists). @ConditionalOnMissingBean(search = SearchStrategy.CURRENT) public BindingService bindingService( BindingServiceProperties bindingServiceProperties, BinderFactory binderFactory, TaskScheduler taskScheduler) { return new BindingService(bindingServiceProperties, binderFactory, taskScheduler); }
Example 9
Source File: EurekaConfigServerBootstrapConfiguration.java From spring-cloud-netflix with Apache License 2.0 | 4 votes |
@Bean @ConditionalOnMissingBean(value = EurekaClientConfig.class, search = SearchStrategy.CURRENT) public EurekaClientConfigBean eurekaClientConfigBean() { return new EurekaClientConfigBean(); }
Example 10
Source File: TarsEurekaAutoConfiguration.java From TarsJava with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Bean @ConditionalOnMissingBean(value = DiscoveryClientOptionalArgs.class, search = SearchStrategy.CURRENT) public DiscoveryClientOptionalArgs discoveryClientOptionalArgs() { return new DiscoveryClientOptionalArgs(); }
Example 11
Source File: EurekaClientAutoConfiguration.java From spring-cloud-netflix with Apache License 2.0 | 4 votes |
@Bean @ConditionalOnMissingBean(value = EurekaInstanceConfig.class, search = SearchStrategy.CURRENT) public EurekaInstanceConfigBean eurekaInstanceConfigBean(InetUtils inetUtils, ManagementMetadataProvider managementMetadataProvider) { String hostname = getProperty("eureka.instance.hostname"); boolean preferIpAddress = Boolean .parseBoolean(getProperty("eureka.instance.prefer-ip-address")); String ipAddress = getProperty("eureka.instance.ip-address"); boolean isSecurePortEnabled = Boolean .parseBoolean(getProperty("eureka.instance.secure-port-enabled")); String serverContextPath = env.getProperty("server.servlet.context-path", "/"); int serverPort = Integer.parseInt( env.getProperty("server.port", env.getProperty("port", "8080"))); Integer managementPort = env.getProperty("management.server.port", Integer.class); String managementContextPath = env .getProperty("management.server.servlet.context-path"); Integer jmxPort = env.getProperty("com.sun.management.jmxremote.port", Integer.class); EurekaInstanceConfigBean instance = new EurekaInstanceConfigBean(inetUtils); instance.setNonSecurePort(serverPort); instance.setInstanceId(getDefaultInstanceId(env)); instance.setPreferIpAddress(preferIpAddress); instance.setSecurePortEnabled(isSecurePortEnabled); if (StringUtils.hasText(ipAddress)) { instance.setIpAddress(ipAddress); } if (isSecurePortEnabled) { instance.setSecurePort(serverPort); } if (StringUtils.hasText(hostname)) { instance.setHostname(hostname); } String statusPageUrlPath = getProperty("eureka.instance.status-page-url-path"); String healthCheckUrlPath = getProperty("eureka.instance.health-check-url-path"); if (StringUtils.hasText(statusPageUrlPath)) { instance.setStatusPageUrlPath(statusPageUrlPath); } if (StringUtils.hasText(healthCheckUrlPath)) { instance.setHealthCheckUrlPath(healthCheckUrlPath); } ManagementMetadata metadata = managementMetadataProvider.get(instance, serverPort, serverContextPath, managementContextPath, managementPort); if (metadata != null) { instance.setStatusPageUrl(metadata.getStatusPageUrl()); instance.setHealthCheckUrl(metadata.getHealthCheckUrl()); if (instance.isSecurePortEnabled()) { instance.setSecureHealthCheckUrl(metadata.getSecureHealthCheckUrl()); } Map<String, String> metadataMap = instance.getMetadataMap(); metadataMap.computeIfAbsent("management.port", k -> String.valueOf(metadata.getManagementPort())); } else { // without the metadata the status and health check URLs will not be set // and the status page and health check url paths will not include the // context path so set them here if (StringUtils.hasText(managementContextPath)) { instance.setHealthCheckUrlPath( managementContextPath + instance.getHealthCheckUrlPath()); instance.setStatusPageUrlPath( managementContextPath + instance.getStatusPageUrlPath()); } } setupJmxPort(instance, jmxPort); return instance; }
Example 12
Source File: ConfigurationPropertiesRebinderAutoConfiguration.java From spring-cloud-commons with Apache License 2.0 | 4 votes |
@Bean @ConditionalOnMissingBean(search = SearchStrategy.CURRENT) public static ConfigurationPropertiesBeans configurationPropertiesBeans() { return new ConfigurationPropertiesBeans(); }
Example 13
Source File: EnvironmentRepositoryConfiguration.java From spring-cloud-config with Apache License 2.0 | 4 votes |
@Bean @ConditionalOnMissingBean(search = SearchStrategy.CURRENT) public MultipleJGitEnvironmentProperties multipleJGitEnvironmentProperties() { return new MultipleJGitEnvironmentProperties(); }
Example 14
Source File: AppEngineMemcachedCacheAutoConfiguration.java From memcached-spring-boot with Apache License 2.0 | 4 votes |
@Bean @ConditionalOnMissingBean(value = MemcachedCacheManager.class, search = SearchStrategy.CURRENT) public MemcachedCacheManager cacheManager(MemcachedCacheProperties properties) throws IOException { return new AppEngineMemcachedCacheManagerFactory(properties).create(); }
Example 15
Source File: AppEngineMemcachedCacheAutoConfiguration.java From memcached-spring-boot with Apache License 2.0 | 4 votes |
@Bean @RefreshScope @ConditionalOnMissingBean(value = MemcachedCacheManager.class, search = SearchStrategy.CURRENT) public MemcachedCacheManager cacheManager(MemcachedCacheProperties properties) throws IOException { return new AppEngineMemcachedCacheManagerFactory(properties).create(); }
Example 16
Source File: XMemcachedCacheAutoConfiguration.java From memcached-spring-boot with Apache License 2.0 | 4 votes |
@Bean @ConditionalOnMissingBean(value = MemcachedCacheManager.class, search = SearchStrategy.CURRENT) public MemcachedCacheManager cacheManager(MemcachedCacheProperties properties) throws IOException { return new XMemcachedCacheManagerFactory(properties).create(); }
Example 17
Source File: XMemcachedCacheAutoConfiguration.java From memcached-spring-boot with Apache License 2.0 | 4 votes |
@Bean @RefreshScope @ConditionalOnMissingBean(value = MemcachedCacheManager.class, search = SearchStrategy.CURRENT) public MemcachedCacheManager cacheManager(MemcachedCacheProperties properties) throws IOException { return new XMemcachedCacheManagerFactory(properties).create(); }
Example 18
Source File: CrnkErrorControllerAutoConfiguration.java From crnk-framework with Apache License 2.0 | 4 votes |
@Bean @ConditionalOnMissingBean(value = ErrorController.class, search = SearchStrategy.CURRENT) public BasicErrorController jsonapiErrorController(ErrorAttributes errorAttributes) { return new CrnkErrorController(errorAttributes, this.serverProperties.getError(), this.errorViewResolvers); }
Example 19
Source File: BladeErrorMvcAutoConfiguration.java From blade-tool with GNU Lesser General Public License v3.0 | 4 votes |
@Bean @ConditionalOnMissingBean(value = ErrorController.class, search = SearchStrategy.CURRENT) public BasicErrorController basicErrorController(ErrorAttributes errorAttributes) { return new BladeErrorController(errorAttributes, serverProperties.getError()); }
Example 20
Source File: BladeErrorMvcAutoConfiguration.java From blade-tool with GNU Lesser General Public License v3.0 | 4 votes |
@Bean @ConditionalOnMissingBean(value = ErrorAttributes.class, search = SearchStrategy.CURRENT) public DefaultErrorAttributes errorAttributes() { return new BladeErrorAttributes(); }