Browse Source

Add initialization of JsonXStream back.

fixes gh-535
pull/6/head
Spencer Gibb 9 years ago
parent
commit
4037f4ca80
  1. 7
      spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/eureka/EurekaClientAutoConfiguration.java
  2. 12
      spring-cloud-netflix-eureka-server/src/main/java/org/springframework/cloud/netflix/eureka/server/EurekaServerInitializerConfiguration.java

7
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/eureka/EurekaClientAutoConfiguration.java

@ -21,6 +21,8 @@ import java.util.concurrent.ConcurrentMap;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import lombok.SneakyThrows;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.AutoConfigureBefore; import org.springframework.boot.autoconfigure.AutoConfigureBefore;
@ -45,10 +47,9 @@ import com.netflix.appinfo.EurekaInstanceConfig;
import com.netflix.appinfo.InstanceInfo; import com.netflix.appinfo.InstanceInfo;
import com.netflix.discovery.EurekaClient; import com.netflix.discovery.EurekaClient;
import com.netflix.discovery.EurekaClientConfig; import com.netflix.discovery.EurekaClientConfig;
import com.netflix.discovery.converters.JsonXStream;
import com.netflix.discovery.converters.XmlXStream; import com.netflix.discovery.converters.XmlXStream;
import lombok.SneakyThrows;
/** /**
* @author Dave Syer * @author Dave Syer
*/ */
@ -72,6 +73,8 @@ public class EurekaClientAutoConfiguration implements ApplicationListener<Parent
DataCenterAwareJacksonCodec.init(); DataCenterAwareJacksonCodec.init();
XmlXStream.getInstance().setMarshallingStrategy( XmlXStream.getInstance().setMarshallingStrategy(
new DataCenterAwareMarshallingStrategy()); new DataCenterAwareMarshallingStrategy());
JsonXStream.getInstance().setMarshallingStrategy(
new DataCenterAwareMarshallingStrategy());
} }
@Bean @Bean

12
spring-cloud-netflix-eureka-server/src/main/java/org/springframework/cloud/netflix/eureka/server/EurekaServerInitializerConfiguration.java

@ -58,6 +58,7 @@ import org.springframework.web.context.ServletContextAware;
import com.netflix.blitz4j.DefaultBlitz4jConfig; import com.netflix.blitz4j.DefaultBlitz4jConfig;
import com.netflix.blitz4j.LoggingConfiguration; import com.netflix.blitz4j.LoggingConfiguration;
import com.netflix.discovery.converters.JsonXStream;
import com.netflix.discovery.converters.XmlXStream; import com.netflix.discovery.converters.XmlXStream;
import com.netflix.eureka.AbstractInstanceRegistry; import com.netflix.eureka.AbstractInstanceRegistry;
import com.netflix.eureka.EurekaBootStrap; import com.netflix.eureka.EurekaBootStrap;
@ -145,14 +146,13 @@ public class EurekaServerInitializerConfiguration implements ServletContextAware
// ignore // ignore
} }
LoggingConfiguration.getInstance().configure(); LoggingConfiguration.getInstance().configure();
EurekaServerConfigurationManager EurekaServerConfigurationManager.getInstance()
.getInstance()
.setConfiguration( .setConfiguration(
EurekaServerInitializerConfiguration.this.eurekaServerConfig); EurekaServerInitializerConfiguration.this.eurekaServerConfig);
XmlXStream XmlXStream.getInstance().setMarshallingStrategy(
.getInstance() new DataCenterAwareMarshallingStrategy());
.setMarshallingStrategy( JsonXStream.getInstance().setMarshallingStrategy(
new DataCenterAwareMarshallingStrategy()); new DataCenterAwareMarshallingStrategy());
DataCenterAwareJacksonCodec.init(); DataCenterAwareJacksonCodec.init();
EurekaServerInitializerConfiguration.this.applicationContext EurekaServerInitializerConfiguration.this.applicationContext
.publishEvent(new EurekaRegistryAvailableEvent( .publishEvent(new EurekaRegistryAvailableEvent(

Loading…
Cancel
Save