spring-cloud-bus: Configuration is not refreshed while using spring.profiles.active on client side

Configuration is not refreshed when I am using spring profiles. During the client startup, the configuration is properly fetched from config server. Without the spring.profiles.active refresh works correctly.

I am using RabbitMQ to integrate the services. springCloudVersion = ‘Finchley.BUILD-SNAPSHOT’

Client bootstrap.yml:

spring:
  application:
    name: springconfclient
  profiles:
    active: dev
  cloud:
    config:
      uri: http://localhost:8888
  rabbitmq:
    host: localhost
    port: 5672
    username: guest
    password: guest

Both projects can be found here:

I have done some debugging and I think the problem is inside ServiceMatcher.isForSelf:

public boolean isForSelf(RemoteApplicationEvent event) {
	String destinationService = event.getDestinationService();
	return (destinationService == null || destinationService.trim().isEmpty()
			|| this.matcher.match(destinationService, getServiceId()));
}

The PathMatcher does not take active profiles into consideration.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 15 (4 by maintainers)

Most upvoted comments

I don’t think it will be in 3.1.x. 4.0 will be in December.

Try adding the following at client side instead of changing default service Id at code spring.cloud.bus.id=${vcap.application.name:${spring.application.name:application}😒{spring.profiles.active}}😒{vcap.application.instance_index:${spring.application.index:${local.server.port:${server.port:0}}}}😒{vcap.application.instance_id:${random.value}}