Commit 4721bee8 by Spencer Gibb

allow EurekaServerConfig to be overridden.

fixes gh-657
parent 415cd1d8
...@@ -30,6 +30,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -30,6 +30,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.web.HttpEncodingProperties; import org.springframework.boot.autoconfigure.web.HttpEncodingProperties;
import org.springframework.boot.context.embedded.FilterRegistrationBean; import org.springframework.boot.context.embedded.FilterRegistrationBean;
...@@ -104,6 +105,12 @@ public class EurekaServerConfiguration extends WebMvcConfigurerAdapter { ...@@ -104,6 +105,12 @@ public class EurekaServerConfiguration extends WebMvcConfigurerAdapter {
return HasFeatures.namedFeature("Eureka Server", EurekaServerConfiguration.class); return HasFeatures.namedFeature("Eureka Server", EurekaServerConfiguration.class);
} }
@Bean
@ConditionalOnMissingBean
public EurekaServerConfig eurekaServerConfig() {
return new EurekaServerConfigBean();
}
//TODO: is there a better way? //TODO: is there a better way?
@Bean(name = "spring.http.encoding.CONFIGURATION_PROPERTIES") @Bean(name = "spring.http.encoding.CONFIGURATION_PROPERTIES")
public HttpEncodingProperties httpEncodingProperties() { public HttpEncodingProperties httpEncodingProperties() {
......
...@@ -17,12 +17,8 @@ ...@@ -17,12 +17,8 @@
package org.springframework.cloud.netflix.eureka.server; package org.springframework.cloud.netflix.eureka.server;
import javax.servlet.ServletContext; import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import lombok.extern.apachecommons.CommonsLog;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.netflix.eureka.server.event.EurekaRegistryAvailableEvent; import org.springframework.cloud.netflix.eureka.server.event.EurekaRegistryAvailableEvent;
import org.springframework.cloud.netflix.eureka.server.event.EurekaServerStartedEvent; import org.springframework.cloud.netflix.eureka.server.event.EurekaServerStartedEvent;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
...@@ -34,11 +30,12 @@ import org.springframework.web.context.ServletContextAware; ...@@ -34,11 +30,12 @@ import org.springframework.web.context.ServletContextAware;
import com.netflix.eureka.EurekaServerConfig; import com.netflix.eureka.EurekaServerConfig;
import lombok.extern.apachecommons.CommonsLog;
/** /**
* @author Dave Syer * @author Dave Syer
*/ */
@Configuration @Configuration
@EnableConfigurationProperties(EurekaServerConfigBean.class)
@CommonsLog @CommonsLog
public class EurekaServerInitializerConfiguration public class EurekaServerInitializerConfiguration
implements ServletContextAware, SmartLifecycle, Ordered { implements ServletContextAware, SmartLifecycle, Ordered {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment