1

I've generated a spring boot config server from spring's initialzr.

I've installed rabbitmq with brew. initialzr generated with boot version 2.1.1.RELEASE and cloud version Greenwich.M3.

the simple rest services are connecting to rabbitmq queues. the config server is connection to a gitlab config repo.

But when I commit and push a change to it, the change is not reflected by the service application. The config server gets logs messages when the push is completed. Can anyone say what might be wrong? No messages ever seem to appear in rabbitmq console. I have been able to refresh the properties via actuator/bus-refresh through rabbitmq though.

config-server log messages on commit of change to config-repo's employee-service.yml file:

2018-12-07 11:53:12.185  INFO 84202 --- [nio-8888-exec-1] o.s.c.c.monitor.PropertyPathEndpoint     : Refresh for: employee:service
2018-12-07 11:53:12.228  INFO 84202 --- [nio-8888-exec-1] trationDelegate$BeanPostProcessorChecker : Bean 'configurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$b43cc593] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-12-07 11:53:12.253  INFO 84202 --- [nio-8888-exec-1] o.s.boot.SpringApplication               : No active profile set, falling back to default profiles: default
2018-12-07 11:53:12.259  INFO 84202 --- [nio-8888-exec-1] o.s.boot.SpringApplication               : Started application in 0.072 seconds (JVM running for 3075.606)
2018-12-07 11:53:12.345  INFO 84202 --- [nio-8888-exec-1] o.s.cloud.bus.event.RefreshListener      : Received remote refresh request. Keys refreshed []
2018-12-07 11:53:12.345  INFO 84202 --- [nio-8888-exec-1] o.s.c.c.monitor.PropertyPathEndpoint     : Refresh for: employee-service
2018-12-07 11:53:12.377  INFO 84202 --- [nio-8888-exec-1] trationDelegate$BeanPostProcessorChecker : Bean 'configurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$b43cc593] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-12-07 11:53:12.398  INFO 84202 --- [nio-8888-exec-1] o.s.boot.SpringApplication               : No active profile set, falling back to default profiles: default
2018-12-07 11:53:12.402  INFO 84202 --- [nio-8888-exec-1] o.s.boot.SpringApplication               : Started application in 0.056 seconds (JVM running for 3075.749)
2018-12-07 11:53:12.489  INFO 84202 --- [nio-8888-exec-1] o.s.cloud.bus.event.RefreshListener      : Received remote refresh request. Keys refreshed []

config-server has this application.yml:

---

server:
  port: ${PORT:8888}

spring:
  cloud:
    bus:
      enabled: true
    config:
      server:
        git:
          uri: ${CONFIG_REPO_URI:git@gitlab.<somedomain>:<somegroup>/config-repo.git}
          search-paths:
          - feature/initial-repo

  main:
    banner-mode: "off"

and ConfigServerApplication.java:

@SpringBootApplication
@EnableConfigServer
public class ConfigServerApplication {

    public static void main(String[] args) {
        SpringApplication.run(ConfigServerApplication.class, args);
    }
}

and these gradle dependencies:

dependencies {
    implementation('org.springframework.cloud:spring-cloud-config-server')
    implementation('org.springframework.cloud:spring-cloud-starter-stream-rabbit')
    implementation('org.springframework.cloud:spring-cloud-config-monitor')
    testImplementation('org.springframework.boot:spring-boot-starter-test')
    implementation('org.springframework.cloud:spring-cloud-stream-test-support')
}

service has this applciation.yml:

---
server:
  port: 8092

management:
  security:
    enabled: "false"

  endpoints:
    web:
      exposure:
        include: 
        - '*'

spring:
  main:
    banner-mode: "off"

  rabbitmq:
    host: localhost
    port: 5672
    username: guest
    password: guest

this bootstrap.yml:

---

spring:
  application:
    name: employee-service

  cloud:
    config:
      uri: 
      - http://localhost:8888
      label: feature(_)initial-repo

these gradle dependencies:

dependencies {
    implementation('org.springframework.boot:spring-boot-starter-web')
    implementation('org.springframework.cloud:spring-cloud-starter-config')
    implementation('org.springframework.cloud:spring-cloud-starter-bus-amqp')
    implementation('org.springframework.boot:spring-boot-starter-actuator')
    testImplementation('org.springframework.boot:spring-boot-starter-test')
}

this main class:

@SpringBootApplication
public class EmployeeServiceApplication {

    public static void main(String[] args) {
        SpringApplication.run(EmployeeServiceApplication.class, args);
    }
}

and this controller class:

@RefreshScope
@RestController
public class WelcomeController {

    @Value("${app.service-name}")
    private String serviceName;

    @Value("${app.shared.attribute}")
    private String sharedAttribute;

    @GetMapping("/service")
    public String getServiceName() {
        return "service name [" + this.serviceName + "]";
    }

    @GetMapping("/shared")
    public String getSharedAttribute() {
        return " application.yml [" + this.sharedAttribute + "]";
    }
}
Iggs
  • 30
  • 5
  • I’ve narrowed it down. The config server I built works with the sample service from the example site I’m working from. It just doesn’t work with the service I built from sts 4. – Iggs Dec 12 '18 at 01:14

1 Answers1

1

Try to create and build your project with Maven instead of Gradle.

I experience the same problem. I have two identical apps with the same RabbitMQ dependencies, one is build with Maven and second with Gradle. The Maven-based app publishes things to RabbitMQ as expected. The very same app, built with Gradle doesn't establish connection to RabbitMQ and is not publishing events. To further clarify things, I run both apps in Eclipse with Spring Tools.

  • when I clone the repo here: htthttps://github.com/chathurangat/spring-cloud-config-webhook-stream-bus-example.git, change the properties files to my local conditions (macos with rabbitmq), build with clean package and run with spring-boot:run, when I commit a new value for the service name, and check the service with postman, it works. My attempts at replicating in spring tool suite 4 eclipse, with starters, fails, no matter how identical I seem to make it. only 2 yml and 1 class for config and 2 and 2 for service. – Iggs Dec 11 '18 at 20:36
  • when I moved over to maven, I ended up with the wrong amqp dependency, from the boot package, instead of from the cloud package. when I switched to the correct dependency, things started working. Also Greenwich.RC1 became available in the milestones repo today, and I switched to that and things seems to be working. I also did a clean repo build for that. – Iggs Dec 12 '18 at 19:23
  • Lggs, good finding. I tied to run my Gradle-based rabbitmg project with the help of Spring Tools Suite (STS) and my app is not connecting to RabbitMQ. I tried it with Eclipse 2018-09 and STS 4 and I used Greenwich.RC1. However, I can successfully run my app (connect to RabbitMQ and publish events) when I run it in Eclipse as "Run as / Java Application". Also running app externally to Eclipse from command line works fine. Another alternative would be to build jar with Gradle and in Eclipse setup "Run / External Tools / External Tools Confgurations" and run app with java -jar – Jarek Krych Dec 13 '18 at 20:24
  • did you try the "run as spring boot application, or try to run from the Boot Dashboard in STS? – Iggs Dec 14 '18 at 21:54
  • I think this is the issue that was fixed that allowed Greenwich.RC1 to work for me: https://github.com/spring-cloud/spring-cloud-config/issues/1197 – Iggs Dec 14 '18 at 21:58
  • In my case, RabbitMQ app didn't work when I tried: "Run As / Spring Boot App". – Jarek Krych Dec 15 '18 at 20:52