Remove unecessary context id initializer (Spring Boot 1.3.2)

Also changes default destination name to not contain "topic:" prefix
(this is the default behaviour in stream now).
This commit is contained in:
Dave Syer
2016-01-28 17:23:18 +00:00
parent 28ad6b25fd
commit e5d1570bf4
3 changed files with 1 additions and 54 deletions

View File

@@ -47,20 +47,13 @@ public class BusProperties {
/**
* Name of Spring Cloud Stream destination for messages.
*/
private String destination = "topic:springCloudBus";
private String destination = "springCloudBus";
/**
* Flag to indicate that the bus is enabled.
*/
private boolean enabled = true;
public String getDestination() {
if (this.destination.startsWith("topic:")) {
return this.destination;
}
return "topic:" + this.destination;
}
@Data
public static class Env {
/**

View File

@@ -1,44 +0,0 @@
/*
* 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.bus.context;
import org.springframework.core.Ordered;
/**
* Workaround for poor choice of ordering in the Spring Boot context id initializer. This
* one prefers a locally provided application name, rather than one provided by the
* platform. Since Spring Cloud apps send each other events on the Bus addressed by
* context id, this can be important when the application name doesn't match the one
* provided in local config.
*
* @author Dave Syer
*
*/
public class ContextIdApplicationContextInitializer
extends org.springframework.boot.context.ContextIdApplicationContextInitializer {
/**
* Placeholder pattern to resolve for application name.
*/
private static final String NAME_PATTERN = "${spring.application.name:${spring.config.name:${vcap.application.name:application}}}";
public ContextIdApplicationContextInitializer() {
super(NAME_PATTERN);
setOrder(Ordered.LOWEST_PRECEDENCE - 5);
}
}

View File

@@ -1,5 +1,3 @@
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
org.springframework.cloud.bus.BusAutoConfiguration,\
org.springframework.cloud.bus.jackson.BusJacksonAutoConfiguration
org.springframework.context.ApplicationContextInitializer=\
org.springframework.cloud.bus.context.ContextIdApplicationContextInitializer