2

I am trying to build basic spring boot cloud config server and client application using this link.
Config server starts up without any issue but when I start config client it starts and then gets killed instantly. It is also able to reach to config server as per logs but something is fishy. I tried debug=true as well but there are no specific logs.

Following is the ConfigClient class

package com.consul.client.ConsulClient;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.core.env.Environment;

@SpringBootApplication
public class ConsulClientApplication {

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

    @Autowired
    public void setEnv(Environment e) {
        System.out.println(e.getProperty("msg"));
    }

}

and below is the bootstrap.properties file

server.port=8081
spring.cloud.config.uri=http://localhost:9081
spring.application.name=client-config
debug=true
management.security.enabled=false

and start-up logs are as follows

2020-03-23 00:09:37.048  INFO 1166 --- [           main] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at : http://localhost:9081
2020-03-23 00:09:38.154  INFO 1166 --- [           main] c.c.c.ConfigServicePropertySourceLocator : Located environment: name=client-config, profiles=[dev], label=null, version=14a9dd2ad6b13bb2215de9f0945f48dc15e2f10e, state=null
2020-03-23 00:09:38.155  INFO 1166 --- [           main] b.c.PropertySourceBootstrapConfiguration : Located property source: [BootstrapPropertySource {name='bootstrapProperties-configClient'}, BootstrapPropertySource {name='bootstrapProperties-https://github.com/jagginarendra/configserver/client-config-dev.properties'}, BootstrapPropertySource {name='bootstrapProperties-https://github.com/jagginarendra/configserver/client-config.properties'}]
2020-03-23 00:09:38.164  INFO 1166 --- [           main] c.c.c.C.ConsulClientApplication          : The following profiles are active: dev
2020-03-23 00:09:38.470  INFO 1166 --- [           main] o.s.cloud.context.scope.GenericScope     : BeanFactory id=9f0269c4-90eb-309e-8c49-d7fc7be3daa5
this is dev enc
2020-03-23 00:09:38.600  INFO 1166 --- [           main] c.c.c.C.ConsulClientApplication          : Started ConsulClientApplication in 7.314 seconds (JVM running for 7.802)

Process finished with exit code 0
Narendra Jaggi
  • 1,297
  • 11
  • 33
  • 3
    I think you created simple spring app not web based. There is no log about 8081 port you set. You should use starter web instead of just spring starter. – matejko219 Mar 22 '20 at 18:57
  • I'm also facing the same issue, I don't see any exceptions as such. Any idea what could be the issue? – Sumanth Varada Dec 03 '20 at 11:12

0 Answers0