diff --git a/spring-cloud-stream-codec/pom.xml b/spring-cloud-stream-codec/pom.xml
index 1844cc3a1..c36b94656 100644
--- a/spring-cloud-stream-codec/pom.xml
+++ b/spring-cloud-stream-codec/pom.xml
@@ -40,6 +40,14 @@
org.springframework.bootspring-boot-starter-logging
+
+ org.springframework.boot
+ spring-boot-autoconfigure
+
+
+ com.fasterxml.jackson.core
+ jackson-annotations
+ org.springframework.bootspring-boot-starter-test
diff --git a/spring-cloud-stream-codec/src/main/java/org/springframework/cloud/stream/config/CodecConfiguration.java b/spring-cloud-stream-codec/src/main/java/org/springframework/cloud/stream/config/CodecConfiguration.java
new file mode 100644
index 000000000..94af0efea
--- /dev/null
+++ b/spring-cloud-stream-codec/src/main/java/org/springframework/cloud/stream/config/CodecConfiguration.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2015 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.cloud.stream.config;
+
+import java.util.ArrayList;
+import java.util.Map;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.xd.dirt.integration.bus.serializer.MultiTypeCodec;
+import org.springframework.xd.dirt.integration.bus.serializer.kryo.FileKryoRegistrar;
+import org.springframework.xd.dirt.integration.bus.serializer.kryo.KryoRegistrar;
+import org.springframework.xd.dirt.integration.bus.serializer.kryo.PojoCodec;
+
+/**
+ * @author David Turanski
+ */
+@Configuration
+public class CodecConfiguration {
+
+
+ @Autowired
+ ApplicationContext applicationContext;
+
+ @ConditionalOnMissingBean(KryoCodecProperties.class)
+ @Bean(name = "spring.cloud.streams.codec.kryo.CONFIGURATION_PROPERTIES")
+ public KryoCodecProperties kryoCodecProperties() {
+ return new KryoCodecProperties();
+ }
+
+ @Bean
+ @ConditionalOnMissingBean(name = "codec")
+ public MultiTypeCodec> codec() {
+ Map kryoRegistrarMap = applicationContext.getBeansOfType(KryoRegistrar
+ .class);
+ return new PojoCodec(new ArrayList<>(kryoRegistrarMap.values()), kryoCodecProperties().isReferences());
+ }
+
+ @Bean
+ public KryoRegistrar fileRegistrar() {
+ return new FileKryoRegistrar();
+ }
+}
diff --git a/spring-cloud-stream-codec/src/main/java/org/springframework/cloud/stream/config/KryoCodecProperties.java b/spring-cloud-stream-codec/src/main/java/org/springframework/cloud/stream/config/KryoCodecProperties.java
new file mode 100644
index 000000000..bd5d415ed
--- /dev/null
+++ b/spring-cloud-stream-codec/src/main/java/org/springframework/cloud/stream/config/KryoCodecProperties.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2015 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.cloud.stream.config;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+/**
+ * @author David Turanski
+ */
+@ConfigurationProperties("spring.cloud.codec.kryo")
+@JsonInclude(JsonInclude.Include.NON_DEFAULT)
+public class KryoCodecProperties {
+ private boolean references = true;
+
+ public boolean isReferences() {
+ return references;
+ }
+
+ public void setReferences(boolean references) {
+ this.references = references;
+ }
+
+}
diff --git a/spring-cloud-stream-codec/src/main/java/org/springframework/xd/dirt/integration/bus/serializer/kryo/AbstractKryoCodec.java b/spring-cloud-stream-codec/src/main/java/org/springframework/xd/dirt/integration/bus/serializer/kryo/AbstractKryoCodec.java
index 12249e157..a967f22b6 100644
--- a/spring-cloud-stream-codec/src/main/java/org/springframework/xd/dirt/integration/bus/serializer/kryo/AbstractKryoCodec.java
+++ b/spring-cloud-stream-codec/src/main/java/org/springframework/xd/dirt/integration/bus/serializer/kryo/AbstractKryoCodec.java
@@ -28,21 +28,18 @@ import com.esotericsoftware.kryo.pool.KryoFactory;
import com.esotericsoftware.kryo.pool.KryoPool;
import org.springframework.util.Assert;
-import org.springframework.xd.dirt.integration.bus.serializer.AbstractCodec;
+import org.springframework.xd.dirt.integration.bus.serializer.MultiTypeCodec;
/**
* Base class for Codecs using {@link com.esotericsoftware.kryo.Kryo}
- *
* @author David Turanski
*/
-public abstract class AbstractKryoCodec extends AbstractCodec {
-
- private final KryoFactory factory;
+public abstract class AbstractKryoCodec implements MultiTypeCodec