Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
spring-cloud-netflix
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
openSource
spring-cloud-netflix
Commits
0e4eb9ef
Commit
0e4eb9ef
authored
Jan 15, 2015
by
Dave Syer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use @ConditionalOnProperty where possible
parent
90d7e5df
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
28 additions
and
27 deletions
+28
-27
EurekaClientAutoConfiguration.java
...k/cloud/netflix/eureka/EurekaClientAutoConfiguration.java
+2
-2
EurekaDiscoveryClientConfiguration.java
...ud/netflix/eureka/EurekaDiscoveryClientConfiguration.java
+2
-2
HystrixAutoConfiguration.java
...ework/cloud/netflix/hystrix/HystrixAutoConfiguration.java
+2
-2
HystrixCircuitBreakerConfiguration.java
...d/netflix/hystrix/HystrixCircuitBreakerConfiguration.java
+14
-13
RibbonEurekaAutoConfiguration.java
.../netflix/ribbon/eureka/RibbonEurekaAutoConfiguration.java
+2
-2
HystrixStreamAutoConfiguration.java
.../netflix/hystrix/amqp/HystrixStreamAutoConfiguration.java
+2
-2
SidecarConfiguration.java
...framework/cloud/netflix/sidecar/SidecarConfiguration.java
+2
-2
TurbineAmqpAutoConfiguration.java
...ud/netflix/turbine/amqp/TurbineAmqpAutoConfiguration.java
+2
-2
No files found.
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/eureka/EurekaClientAutoConfiguration.java
View file @
0e4eb9ef
...
@@ -19,8 +19,8 @@ import javax.annotation.PostConstruct;
...
@@ -19,8 +19,8 @@ import javax.annotation.PostConstruct;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnClass
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnClass
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnExpression
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
...
@@ -38,7 +38,7 @@ import com.netflix.discovery.converters.XmlXStream;
...
@@ -38,7 +38,7 @@ import com.netflix.discovery.converters.XmlXStream;
@Configuration
@Configuration
@EnableConfigurationProperties
@EnableConfigurationProperties
@ConditionalOnClass
(
EurekaClientConfig
.
class
)
@ConditionalOnClass
(
EurekaClientConfig
.
class
)
@ConditionalOn
Expression
(
"${eureka.client.enabled:true}"
)
@ConditionalOn
Property
(
value
=
"eureka.client.enabled"
,
matchIfMissing
=
true
)
public
class
EurekaClientAutoConfiguration
{
public
class
EurekaClientAutoConfiguration
{
@Autowired
@Autowired
...
...
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/eureka/EurekaDiscoveryClientConfiguration.java
View file @
0e4eb9ef
...
@@ -28,8 +28,8 @@ import org.springframework.boot.actuate.endpoint.Endpoint;
...
@@ -28,8 +28,8 @@ import org.springframework.boot.actuate.endpoint.Endpoint;
import
org.springframework.boot.actuate.metrics.reader.MetricReader
;
import
org.springframework.boot.actuate.metrics.reader.MetricReader
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnBean
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnBean
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnClass
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnClass
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnExpression
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
;
import
org.springframework.boot.context.embedded.EmbeddedServletContainerInitializedEvent
;
import
org.springframework.boot.context.embedded.EmbeddedServletContainerInitializedEvent
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.cloud.client.discovery.DiscoveryClient
;
import
org.springframework.cloud.client.discovery.DiscoveryClient
;
...
@@ -60,7 +60,7 @@ import com.netflix.discovery.shared.EurekaJerseyClient;
...
@@ -60,7 +60,7 @@ import com.netflix.discovery.shared.EurekaJerseyClient;
@Configuration
@Configuration
@EnableConfigurationProperties
@EnableConfigurationProperties
@ConditionalOnClass
(
EurekaClientConfig
.
class
)
@ConditionalOnClass
(
EurekaClientConfig
.
class
)
@ConditionalOn
Expression
(
"${eureka.client.enabled:true}"
)
@ConditionalOn
Property
(
value
=
"eureka.client.enabled"
,
matchIfMissing
=
true
)
public
class
EurekaDiscoveryClientConfiguration
implements
SmartLifecycle
,
Ordered
{
public
class
EurekaDiscoveryClientConfiguration
implements
SmartLifecycle
,
Ordered
{
private
static
final
Logger
logger
=
LoggerFactory
private
static
final
Logger
logger
=
LoggerFactory
...
...
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/hystrix/HystrixAutoConfiguration.java
View file @
0e4eb9ef
...
@@ -20,7 +20,7 @@ import org.springframework.boot.actuate.autoconfigure.HealthIndicatorAutoConfigu
...
@@ -20,7 +20,7 @@ import org.springframework.boot.actuate.autoconfigure.HealthIndicatorAutoConfigu
import
org.springframework.boot.actuate.health.HealthIndicator
;
import
org.springframework.boot.actuate.health.HealthIndicator
;
import
org.springframework.boot.autoconfigure.AutoConfigureAfter
;
import
org.springframework.boot.autoconfigure.AutoConfigureAfter
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnClass
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnClass
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOn
Expression
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOn
Property
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
...
@@ -32,7 +32,7 @@ import com.netflix.hystrix.Hystrix;
...
@@ -32,7 +32,7 @@ import com.netflix.hystrix.Hystrix;
*/
*/
@Configuration
@Configuration
@ConditionalOnClass
({
Hystrix
.
class
,
HealthIndicator
.
class
})
@ConditionalOnClass
({
Hystrix
.
class
,
HealthIndicator
.
class
})
@ConditionalOn
Expression
(
"${health.hystrix.enabled:true}"
)
@ConditionalOn
Property
(
value
=
"health.hystrix.enabled"
,
matchIfMissing
=
true
)
@AutoConfigureAfter
({
HealthIndicatorAutoConfiguration
.
class
})
@AutoConfigureAfter
({
HealthIndicatorAutoConfiguration
.
class
})
public
class
HystrixAutoConfiguration
{
public
class
HystrixAutoConfiguration
{
...
...
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/hystrix/HystrixCircuitBreakerConfiguration.java
View file @
0e4eb9ef
...
@@ -16,12 +16,12 @@
...
@@ -16,12 +16,12 @@
package
org
.
springframework
.
cloud
.
netflix
.
hystrix
;
package
org
.
springframework
.
cloud
.
netflix
.
hystrix
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
java.io.IOException
;
import
com.netflix.hystrix.Hystrix
;
import
java.util.Arrays
;
import
com.netflix.hystrix.contrib.javanica.aop.aspectj.HystrixCommandAspec
t
;
import
java.util.HashSe
t
;
import
com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsPoller
;
import
java.util.Map
;
import
com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsPoller.MetricsAsJsonPollerListener
;
import
java.util.Set
;
import
com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet
;
import
org.apache.catalina.core.ApplicationContext
;
import
org.apache.catalina.core.ApplicationContext
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.apache.commons.logging.LogFactory
;
...
@@ -30,18 +30,19 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -30,18 +30,19 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.boot.actuate.endpoint.Endpoint
;
import
org.springframework.boot.actuate.endpoint.Endpoint
;
import
org.springframework.boot.actuate.metrics.GaugeService
;
import
org.springframework.boot.actuate.metrics.GaugeService
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnClass
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnClass
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOn
Expression
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOn
Property
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication
;
import
org.springframework.context.SmartLifecycle
;
import
org.springframework.context.SmartLifecycle
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.core.Ordered
;
import
org.springframework.core.Ordered
;
import
java.io.IOException
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
java.util.Arrays
;
import
com.netflix.hystrix.Hystrix
;
import
java.util.HashSet
;
import
com.netflix.hystrix.contrib.javanica.aop.aspectj.HystrixCommandAspect
;
import
java.util.Map
;
import
com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsPoller
;
import
java.util.Set
;
import
com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsPoller.MetricsAsJsonPollerListener
;
import
com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet
;
/**
/**
* @author Spencer Gibb
* @author Spencer Gibb
...
@@ -61,7 +62,7 @@ public class HystrixCircuitBreakerConfiguration {
...
@@ -61,7 +62,7 @@ public class HystrixCircuitBreakerConfiguration {
}
}
@Configuration
@Configuration
@ConditionalOn
Expression
(
"${hystrix.stream.endpoint.enabled:true}"
)
@ConditionalOn
Property
(
value
=
"hystrix.stream.endpoint.enabled"
,
matchIfMissing
=
true
)
@ConditionalOnWebApplication
@ConditionalOnWebApplication
@ConditionalOnClass
({
Endpoint
.
class
,
HystrixMetricsStreamServlet
.
class
})
@ConditionalOnClass
({
Endpoint
.
class
,
HystrixMetricsStreamServlet
.
class
})
protected
static
class
HystrixWebConfiguration
{
protected
static
class
HystrixWebConfiguration
{
...
...
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/ribbon/eureka/RibbonEurekaAutoConfiguration.java
View file @
0e4eb9ef
...
@@ -18,7 +18,7 @@ package org.springframework.cloud.netflix.ribbon.eureka;
...
@@ -18,7 +18,7 @@ package org.springframework.cloud.netflix.ribbon.eureka;
import
org.springframework.boot.autoconfigure.AutoConfigureAfter
;
import
org.springframework.boot.autoconfigure.AutoConfigureAfter
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnBean
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnBean
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnClass
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnClass
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOn
Expression
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOn
Property
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.cloud.netflix.ribbon.RibbonAutoConfiguration
;
import
org.springframework.cloud.netflix.ribbon.RibbonAutoConfiguration
;
import
org.springframework.cloud.netflix.ribbon.RibbonClients
;
import
org.springframework.cloud.netflix.ribbon.RibbonClients
;
...
@@ -35,7 +35,7 @@ import com.netflix.niws.loadbalancer.DiscoveryEnabledNIWSServerList;
...
@@ -35,7 +35,7 @@ import com.netflix.niws.loadbalancer.DiscoveryEnabledNIWSServerList;
@EnableConfigurationProperties
@EnableConfigurationProperties
@ConditionalOnClass
(
DiscoveryEnabledNIWSServerList
.
class
)
@ConditionalOnClass
(
DiscoveryEnabledNIWSServerList
.
class
)
@ConditionalOnBean
(
SpringClientFactory
.
class
)
@ConditionalOnBean
(
SpringClientFactory
.
class
)
@ConditionalOn
Expression
(
"${ribbon.eureka.enabled:true}"
)
@ConditionalOn
Property
(
value
=
"ribbon.eureka.enabled"
,
matchIfMissing
=
true
)
@AutoConfigureAfter
(
RibbonAutoConfiguration
.
class
)
@AutoConfigureAfter
(
RibbonAutoConfiguration
.
class
)
@RibbonClients
(
defaultConfiguration
=
EurekaRibbonClientConfiguration
.
class
)
@RibbonClients
(
defaultConfiguration
=
EurekaRibbonClientConfiguration
.
class
)
public
class
RibbonEurekaAutoConfiguration
{
public
class
RibbonEurekaAutoConfiguration
{
...
...
spring-cloud-netflix-hystrix-amqp/src/main/java/org/springframework/netflix/hystrix/amqp/HystrixStreamAutoConfiguration.java
View file @
0e4eb9ef
...
@@ -7,7 +7,7 @@ import org.springframework.amqp.rabbit.core.RabbitTemplate;
...
@@ -7,7 +7,7 @@ import org.springframework.amqp.rabbit.core.RabbitTemplate;
import
org.springframework.amqp.support.converter.Jackson2JsonMessageConverter
;
import
org.springframework.amqp.support.converter.Jackson2JsonMessageConverter
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnClass
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnClass
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOn
Expression
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOn
Property
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.cloud.netflix.Constants
;
import
org.springframework.cloud.netflix.Constants
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
...
@@ -27,7 +27,7 @@ import com.netflix.hystrix.HystrixCircuitBreaker;
...
@@ -27,7 +27,7 @@ import com.netflix.hystrix.HystrixCircuitBreaker;
*/
*/
@Configuration
@Configuration
@ConditionalOnClass
({
HystrixCircuitBreaker
.
class
,
RabbitTemplate
.
class
})
@ConditionalOnClass
({
HystrixCircuitBreaker
.
class
,
RabbitTemplate
.
class
})
@ConditionalOn
Expression
(
"${hystrix.stream.amqp.enabled:true}"
)
@ConditionalOn
Property
(
value
=
"hystrix.stream.amqp.enabled"
,
matchIfMissing
=
true
)
@IntegrationComponentScan
(
basePackageClasses
=
HystrixStreamChannel
.
class
)
@IntegrationComponentScan
(
basePackageClasses
=
HystrixStreamChannel
.
class
)
@EnableConfigurationProperties
@EnableConfigurationProperties
@EnableScheduling
@EnableScheduling
...
...
spring-cloud-netflix-sidecar/src/main/java/org/springframework/cloud/netflix/sidecar/SidecarConfiguration.java
View file @
0e4eb9ef
package
org
.
springframework
.
cloud
.
netflix
.
sidecar
;
package
org
.
springframework
.
cloud
.
netflix
.
sidecar
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOn
Expression
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOn
Property
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.cloud.netflix.eureka.EurekaInstanceConfigBean
;
import
org.springframework.cloud.netflix.eureka.EurekaInstanceConfigBean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
...
@@ -12,7 +12,7 @@ import org.springframework.context.annotation.Configuration;
...
@@ -12,7 +12,7 @@ import org.springframework.context.annotation.Configuration;
*/
*/
@Configuration
@Configuration
@EnableConfigurationProperties
@EnableConfigurationProperties
@ConditionalOn
Expression
(
"${sidecar.enabled:true}"
)
@ConditionalOn
Property
(
value
=
"sidecar.enabled"
,
matchIfMissing
=
true
)
public
class
SidecarConfiguration
{
public
class
SidecarConfiguration
{
@Value
(
"${server.port:${SERVER_PORT:${PORT:8080}}}"
)
@Value
(
"${server.port:${SERVER_PORT:${PORT:8080}}}"
)
private
int
serverPort
=
8080
;
private
int
serverPort
=
8080
;
...
...
spring-cloud-netflix-turbine-amqp/src/main/java/org/springframework/cloud/netflix/turbine/amqp/TurbineAmqpAutoConfiguration.java
View file @
0e4eb9ef
...
@@ -15,7 +15,7 @@ import org.springframework.amqp.rabbit.core.RabbitTemplate;
...
@@ -15,7 +15,7 @@ import org.springframework.amqp.rabbit.core.RabbitTemplate;
import
org.springframework.amqp.support.converter.Jackson2JsonMessageConverter
;
import
org.springframework.amqp.support.converter.Jackson2JsonMessageConverter
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnClass
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnClass
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOn
Expression
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOn
Property
;
import
org.springframework.cloud.netflix.Constants
;
import
org.springframework.cloud.netflix.Constants
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
...
@@ -30,7 +30,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
...
@@ -30,7 +30,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
*/
*/
@Configuration
@Configuration
@ConditionalOnClass
(
AmqpTemplate
.
class
)
@ConditionalOnClass
(
AmqpTemplate
.
class
)
@ConditionalOn
Expression
(
"${turbine.amqp.enabled:true}"
)
@ConditionalOn
Property
(
value
=
"turbine.amqp.enabled"
,
matchIfMissing
=
true
)
public
class
TurbineAmqpAutoConfiguration
{
public
class
TurbineAmqpAutoConfiguration
{
@Autowired
@Autowired
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment