Not enforcing EnableAutoConfiguration on aggregate parent

- The aggregate parent configuration now imports the required auto configuration classes such as ChannelBindingAutoConfiguration and EndpointAutoConfiguration
while `@EnableBinding` is still at the parent configuration to be able to share the binding configuration among the child applications
 - Add `ConditionalOnMissingBean` in spring cloud stream auto configuration classes so that if `EnableAutoConfiguration` is enabled at child application classes
they don't get instantiated again
 - Conditionally import EmbeddedServlet auto-configuration when web environment is enabled for parent
 - Add test

Resolves #737
This commit is contained in:
Ilayaperumal Gopinathan
2017-02-15 17:01:43 +05:30
committed by Janne Valkealahti
parent 2df9f9b4ee
commit 8792423abc
7 changed files with 64 additions and 19 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2017 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.
@@ -19,6 +19,7 @@ package org.springframework.cloud.stream.schema.avro;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.stream.binder.StringConvertingContentTypeResolver;
@@ -42,6 +43,7 @@ public class AvroMessageConverterAutoConfiguration {
private AvroMessageConverterProperties avroMessageConverterProperties;
@Bean
@ConditionalOnMissingBean(AvroSchemaRegistryClientMessageConverter.class)
public AvroSchemaRegistryClientMessageConverter avroSchemaMessageConverter(
SchemaRegistryClient schemaRegistryClient) {
AvroSchemaRegistryClientMessageConverter