diff --git a/pom.xml b/pom.xml
index 4be8cd75..f202c157 100644
--- a/pom.xml
+++ b/pom.xml
@@ -35,6 +35,12 @@
com.netflix.archaius
archaius-core
${archaius.version}
+
+
+ commons-logging
+ commons-logging
+
+
com.netflix.eureka
@@ -45,6 +51,16 @@
com.netflix.eureka
eureka-core
${eureka.version}
+
+
+ commons-logging
+ commons-logging
+
+
+ log4j
+ log4j
+
+
com.netflix.feign
diff --git a/spring-platform-netflix-core/pom.xml b/spring-platform-netflix-core/pom.xml
index b8f27db1..0031b704 100644
--- a/spring-platform-netflix-core/pom.xml
+++ b/spring-platform-netflix-core/pom.xml
@@ -4,7 +4,7 @@
4.0.0
spring-platform-netflix-core
- jar
+ jar
spring-platform-netflix-core
Spring Platform Netflix Core
@@ -14,7 +14,7 @@
1.0.0.BUILD-SNAPSHOT
..
-
+
org.springframework.boot
@@ -24,68 +24,68 @@
org.springframework.boot
spring-boot-starter-actuator
-
- com.netflix.archaius
- archaius-core
- true
-
-
- com.netflix.eureka
- eureka-client
- true
-
-
- com.netflix.eureka
- eureka-core
- true
-
-
- net.java.dev.rome
- rome
- 1.0.0
- true
-
-
- com.netflix.feign
- feign-core
- true
-
-
- com.netflix.feign
- feign-ribbon
-
-
-
- com.netflix.hystrix
- hystrix-core
- true
-
-
- com.netflix.hystrix
- hystrix-metrics-event-stream
- true
-
-
- com.netflix.hystrix
- hystrix-javanica
- true
-
-
- com.netflix.ribbon
- ribbon-core
- true
-
-
- com.netflix.ribbon
- ribbon-eureka
- true
-
+
+ com.netflix.archaius
+ archaius-core
+ true
+
+
+ com.netflix.eureka
+ eureka-client
+ true
+
+
+ com.netflix.eureka
+ eureka-core
+ true
+
+
+ net.java.dev.rome
+ rome
+ 1.0.0
+ true
+
+
+ com.netflix.feign
+ feign-core
+ true
+
+
+ com.netflix.feign
+ feign-ribbon
+
+
+
+ com.netflix.hystrix
+ hystrix-core
+ true
+
+
+ com.netflix.hystrix
+ hystrix-metrics-event-stream
+ true
+
+
+ com.netflix.hystrix
+ hystrix-javanica
+ true
+
+
+ com.netflix.ribbon
+ ribbon-core
+ true
+
+
+ com.netflix.ribbon
+ ribbon-eureka
+ true
+
org.projectlombok
lombok
+
+ provided
org.springframework.boot
diff --git a/spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/archaius/ConfigurableEnvironmentConfiguration.java b/spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/archaius/ConfigurableEnvironmentConfiguration.java
index f958db13..0e46ab5d 100644
--- a/spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/archaius/ConfigurableEnvironmentConfiguration.java
+++ b/spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/archaius/ConfigurableEnvironmentConfiguration.java
@@ -1,13 +1,23 @@
package org.springframework.platform.netflix.archaius;
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
import org.apache.commons.configuration.AbstractConfiguration;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.core.env.*;
+import org.springframework.core.env.CompositePropertySource;
+import org.springframework.core.env.ConfigurableEnvironment;
+import org.springframework.core.env.EnumerablePropertySource;
+import org.springframework.core.env.MutablePropertySources;
+import org.springframework.core.env.PropertySource;
+import org.springframework.core.env.StandardEnvironment;
import org.springframework.util.ReflectionUtils;
-import java.lang.reflect.Field;
-import java.util.*;
-
/**
* Created by sgibb on 6/27/14.
*/
diff --git a/spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/circuitbreaker/CircuitBreakerConfiguration.java b/spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/circuitbreaker/CircuitBreakerConfiguration.java
index 4488f669..618f3de8 100644
--- a/spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/circuitbreaker/CircuitBreakerConfiguration.java
+++ b/spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/circuitbreaker/CircuitBreakerConfiguration.java
@@ -50,7 +50,7 @@ public class CircuitBreakerConfiguration implements ImportAware {
throw new IllegalStateException("Only one TransactionManagementConfigurer may exist");
}
//TODO: create CircuitBreakerConfigurer API
- CircuitBreakerConfigurer configurer = configurers.iterator().next();
+ // CircuitBreakerConfigurer configurer = configurers.iterator().next();
//this.txManager = configurer.annotationDrivenTransactionManager();
}
}
diff --git a/spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/endpoint/ServletWrappingEndpoint.java b/spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/endpoint/ServletWrappingEndpoint.java
index 0fff26af..24bd0dca 100644
--- a/spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/endpoint/ServletWrappingEndpoint.java
+++ b/spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/endpoint/ServletWrappingEndpoint.java
@@ -70,7 +70,7 @@ public abstract class ServletWrappingEndpoint implements InitializingBean,
}
@Override
- public Class extends Endpoint> getEndpointType() {
+ public Class extends Endpoint>> getEndpointType() {
return null;
}
}
diff --git a/spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/eureka/EurekaRegistryAvailableEvent.java b/spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/eureka/EurekaRegistryAvailableEvent.java
new file mode 100644
index 00000000..58f86a1b
--- /dev/null
+++ b/spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/eureka/EurekaRegistryAvailableEvent.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2013-2014 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.platform.netflix.eureka;
+
+import org.springframework.context.ApplicationEvent;
+
+import com.netflix.eureka.EurekaServerConfig;
+
+/**
+ * @author Dave Syer
+ *
+ */
+@SuppressWarnings("serial")
+public class EurekaRegistryAvailableEvent extends ApplicationEvent {
+
+ /**
+ * @param eurekaServerConfig
+ */
+ public EurekaRegistryAvailableEvent(EurekaServerConfig eurekaServerConfig) {
+ super(eurekaServerConfig);
+ }
+
+}
diff --git a/spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/eureka/EurekaServerAutoConfiguration.java b/spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/eureka/EurekaServerAutoConfiguration.java
index 53604821..187ef46e 100644
--- a/spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/eureka/EurekaServerAutoConfiguration.java
+++ b/spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/eureka/EurekaServerAutoConfiguration.java
@@ -31,6 +31,7 @@ import com.netflix.blitz4j.LoggingConfiguration;
import com.netflix.eureka.EurekaBootStrap;
import com.netflix.eureka.EurekaServerConfig;
import com.netflix.eureka.EurekaServerConfigurationManager;
+import com.netflix.eureka.PeerAwareInstanceRegistry;
/**
* @author Dave Syer
@@ -69,9 +70,12 @@ public class EurekaServerAutoConfiguration implements ServletContextAware,
LoggingConfiguration.getInstance().configure();
EurekaServerConfigurationManager.getInstance()
.setConfiguration(eurekaServerConfig);
+ PeerAwareInstanceRegistry.getInstance();
+ applicationContext.publishEvent(new EurekaRegistryAvailableEvent(eurekaServerConfig));
}
}.contextInitialized(new ServletContextEvent(servletContext));
running = true;
+ applicationContext.publishEvent(new EurekaServerStartedEvent(eurekaServerConfig));
}
}).start();
}
diff --git a/spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/eureka/EurekaServerStartedEvent.java b/spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/eureka/EurekaServerStartedEvent.java
new file mode 100644
index 00000000..802d9d55
--- /dev/null
+++ b/spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/eureka/EurekaServerStartedEvent.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2013-2014 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.platform.netflix.eureka;
+
+import org.springframework.context.ApplicationEvent;
+
+import com.netflix.eureka.EurekaServerConfig;
+
+/**
+ * @author Dave Syer
+ *
+ */
+@SuppressWarnings("serial")
+public class EurekaServerStartedEvent extends ApplicationEvent {
+
+ /**
+ * @param eurekaServerConfig
+ */
+ public EurekaServerStartedEvent(EurekaServerConfig eurekaServerConfig) {
+ super(eurekaServerConfig);
+ }
+
+}
diff --git a/spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/feign/FeignBase.java b/spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/feign/FeignBase.java
index b2876791..f80e274d 100644
--- a/spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/feign/FeignBase.java
+++ b/spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/feign/FeignBase.java
@@ -1,5 +1,12 @@
package org.springframework.platform.netflix.feign;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.transform.Source;
+
import org.springframework.http.HttpHeaders;
import org.springframework.http.converter.ByteArrayHttpMessageConverter;
import org.springframework.http.converter.HttpMessageConverter;
@@ -14,12 +21,6 @@ import org.springframework.http.converter.xml.SourceHttpMessageConverter;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
-import javax.xml.transform.Source;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-
/**
* Created by sgibb on 6/27/14.
*/
@@ -54,7 +55,8 @@ public class FeignBase {
this.messageConverters.addAll(messageConverters);
}
- protected void addDefaultConverters(List> messageConverters) {
+ @SuppressWarnings("deprecation")
+ protected void addDefaultConverters(List> messageConverters) {
messageConverters.add(new ByteArrayHttpMessageConverter());
messageConverters.add(new StringHttpMessageConverter());
messageConverters.add(new ResourceHttpMessageConverter());
diff --git a/spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/feign/SpringDecoder.java b/spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/feign/SpringDecoder.java
index 1fdff195..81aa51a7 100644
--- a/spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/feign/SpringDecoder.java
+++ b/spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/feign/SpringDecoder.java
@@ -1,87 +1,88 @@
package org.springframework.platform.netflix.feign;
-import feign.FeignException;
-import feign.Response;
-import feign.codec.DecodeException;
-import feign.codec.Decoder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.Type;
+import java.util.List;
+
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.client.ClientHttpResponse;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.web.client.HttpMessageConverterExtractor;
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.reflect.Type;
-import java.util.List;
+import feign.FeignException;
+import feign.Response;
+import feign.codec.DecodeException;
+import feign.codec.Decoder;
/**
* Created by sgibb on 6/26/14.
*/
public class SpringDecoder extends FeignBase implements Decoder {
- private static final Logger logger = LoggerFactory.getLogger(SpringDecoder.class);
-
- public SpringDecoder() {
- }
-
- public SpringDecoder(List> messageConverters) {
- super(messageConverters);
- }
-
- @Override
- public Object decode(final Response response, Type type) throws IOException, DecodeException, FeignException {
- if (type instanceof Class) {
- HttpMessageConverterExtractor> extractor =
- new HttpMessageConverterExtractor((Class>) type, getMessageConverters());
-
- Object data = extractor.extractData(new FeignResponseAdapter(response));
- return data;
- }
- throw new DecodeException("type is not an instance of Class: "+type);
- }
-
- private class FeignResponseAdapter implements ClientHttpResponse {
- private final Response response;
-
- private FeignResponseAdapter(Response response) {
- this.response = response;
- }
-
- @Override
- public HttpStatus getStatusCode() throws IOException {
- return HttpStatus.valueOf(response.status());
- }
-
- @Override
- public int getRawStatusCode() throws IOException {
- return response.status();
- }
-
- @Override
- public String getStatusText() throws IOException {
- return response.reason();
- }
-
- @Override
- public void close() {
- try {
- response.body().close();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- @Override
- public InputStream getBody() throws IOException {
- return response.body().asInputStream();
- }
-
- @Override
- public HttpHeaders getHeaders() {
- return getHttpHeaders(response.headers());
- }
-
- }
+
+ public SpringDecoder() {
+ }
+
+ public SpringDecoder(List> messageConverters) {
+ super(messageConverters);
+ }
+
+ @Override
+ public Object decode(final Response response, Type type) throws IOException,
+ DecodeException, FeignException {
+ if (type instanceof Class) {
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ HttpMessageConverterExtractor> extractor = new HttpMessageConverterExtractor(
+ (Class>) type, getMessageConverters());
+
+ Object data = extractor.extractData(new FeignResponseAdapter(response));
+ return data;
+ }
+ throw new DecodeException("type is not an instance of Class: " + type);
+ }
+
+ private class FeignResponseAdapter implements ClientHttpResponse {
+ private final Response response;
+
+ private FeignResponseAdapter(Response response) {
+ this.response = response;
+ }
+
+ @Override
+ public HttpStatus getStatusCode() throws IOException {
+ return HttpStatus.valueOf(response.status());
+ }
+
+ @Override
+ public int getRawStatusCode() throws IOException {
+ return response.status();
+ }
+
+ @Override
+ public String getStatusText() throws IOException {
+ return response.reason();
+ }
+
+ @Override
+ public void close() {
+ try {
+ response.body().close();
+ }
+ catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public InputStream getBody() throws IOException {
+ return response.body().asInputStream();
+ }
+
+ @Override
+ public HttpHeaders getHeaders() {
+ return getHttpHeaders(response.headers());
+ }
+
+ }
}
diff --git a/spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/feign/SpringEncoder.java b/spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/feign/SpringEncoder.java
index 2e0654ec..6c52bc68 100644
--- a/spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/feign/SpringEncoder.java
+++ b/spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/feign/SpringEncoder.java
@@ -1,9 +1,11 @@
package org.springframework.platform.netflix.feign;
import com.google.common.base.Charsets;
+
import feign.RequestTemplate;
import feign.codec.EncodeException;
import feign.codec.Encoder;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpHeaders;
@@ -21,81 +23,87 @@ import java.util.List;
* Created by sgibb on 6/26/14.
*/
public class SpringEncoder extends FeignBase implements Encoder {
- private static final Logger logger = LoggerFactory.getLogger(SpringEncoder.class);
-
- public SpringEncoder() {
- }
-
- public SpringEncoder(List> messageConverters) {
- super(messageConverters);
- }
-
- @Override
- public void encode(Object requestBody, RequestTemplate request) throws EncodeException {
- //template.body(conversionService.convert(object, String.class));
- if (requestBody != null) {
- Class> requestType = requestBody.getClass();
- Collection contentTypes = request.headers().get("Content-Type");
-
- MediaType requestContentType = null;
- if (contentTypes != null && !contentTypes.isEmpty()) {
- String type = contentTypes.iterator().next();
- requestContentType = MediaType.valueOf(type);
- }
-
- for (HttpMessageConverter> messageConverter : getMessageConverters()) {
- if (messageConverter.canWrite(requestType, requestContentType)) {
- if (logger.isDebugEnabled()) {
- if (requestContentType != null) {
- logger.debug("Writing [" + requestBody + "] as \"" + requestContentType +
- "\" using [" + messageConverter + "]");
- }
- else {
- logger.debug("Writing [" + requestBody + "] using [" + messageConverter + "]");
- }
-
- }
-
- FeignOutputMessage outputMessage = new FeignOutputMessage(request);
- try {
- ((HttpMessageConverter