These are chat archives for spring-cloud/spring-cloud

7th
Mar 2017
Ziemowit
@Ziemowit
Mar 07 2017 07:20

Hi guys I am debugged in EurekaClientAutoConfiguration and I am confused.

int nonSecurePort = 8080 whereas in bootstrap.yml I have defined server.port = 8763...

When I am checking env.getProperty("server.port") it returns 8763 but @Value resolves to 8080.

So the question is. Do you know in which cases it may appear?
I am in this place.

@Configuration
@EnableConfigurationProperties
@ConditionalOnClass(EurekaClientConfig.class)
@ConditionalOnProperty(value = "eureka.client.enabled", matchIfMissing = true)
@AutoConfigureBefore({ NoopDiscoveryClientAutoConfiguration.class,
        CommonsClientAutoConfiguration.class })
@AutoConfigureAfter(name = "org.springframework.cloud.autoconfigure.RefreshAutoConfiguration")
public class EurekaClientAutoConfiguration {

    @Value("${server.port:${SERVER_PORT:${PORT:8080}}}")
    int nonSecurePort;

    @Value("${management.port:${MANAGEMENT_PORT:${server.port:${SERVER_PORT:${PORT:8080}}}}}")
    int managementPort;

    @Value("${eureka.instance.hostname:${EUREKA_INSTANCE_HOSTNAME:}}")
    String hostname;

    @Autowired
    ConfigurableEnvironment env;

    ...

    @Bean
    @ConditionalOnMissingBean(value = EurekaInstanceConfig.class, search = SearchStrategy.CURRENT)
    public EurekaInstanceConfigBean eurekaInstanceConfigBean(InetUtils inetUtils) {
        EurekaInstanceConfigBean instance = new EurekaInstanceConfigBean(inetUtils);
        instance.setNonSecurePort(this.nonSecurePort);
        instance.setInstanceId(getDefaultInstanceId(this.env));
LIN
@magixsource
Mar 07 2017 07:23
do you use spring-config
Ziemowit
@Ziemowit
Mar 07 2017 07:24
you mean spring-cloud-config? The configuration server? No.
I just want to read the value from bootstrap.yml. That is all. The server.port is defined there what can be seen by env.getPropert("server.port").
Because of some reason @Value does not see it.
And uses the default 8080.
LIN
@magixsource
Mar 07 2017 07:25
is that same server.port in application.yml ?
Ziemowit
@Ziemowit
Mar 07 2017 07:25
In application.yml there is no port defined.
So no override.
LIN
@magixsource
Mar 07 2017 07:27
really confused me +1
:(
Ziemowit
@Ziemowit
Mar 07 2017 07:27
The only big difference which comes to my mind is that this single project which does not work is multi-module maven project.
Rest projects which works are not multi-module...
LIN
@magixsource
Mar 07 2017 07:28
maybe it's other kind of override
Ziemowit
@Ziemowit
Mar 07 2017 07:31

I have been thinking about this but no idea how to check it. Did make search through whole project to find 8080 or 80 set somewhere but did not find.

Is using mulit-module project with spring-boot discouraged?

LIN
@magixsource
Mar 07 2017 07:32
i am not good at multi module
:(
Ziemowit
@Ziemowit
Mar 07 2017 07:37
Thank you anyway ;]
LIN
@magixsource
Mar 07 2017 07:38
What's the time in Poland now, AM 7:35 ?
Ziemowit
@Ziemowit
Mar 07 2017 07:38
8:38 ;]
(But had deploy on prod today so in work science 5:40 :D)
LIN
@magixsource
Mar 07 2017 07:39
you are so early
Marcin Grzejszczak
@marcingrzejszczak
Mar 07 2017 07:39
lol
no continuous deployment? :P
LIN
@magixsource
Mar 07 2017 07:40
:clap:
Ziemowit
@Ziemowit
Mar 07 2017 07:42
Lets say that I have limited time in a day + business expectations + I am not original creator of project. But CD is on my road map ;]
Believe me - migrate app to spring-boot was a nightmare.
But now spring-boot + cloud (AMAZING!). Different project :D
LIN
@magixsource
Mar 07 2017 07:43
yes
Marcin Grzejszczak
@marcingrzejszczak
Mar 07 2017 07:43
sweet - check out spring cloud pipelines and you have continuous deployment (almost) OOB ;)
LIN
@magixsource
Mar 07 2017 07:43
what's mean of OOB ?
Ziemowit
@Ziemowit
Mar 07 2017 07:44
Cool! I will read in my first free moment. So... Hmmmm.... Weekend. Yes weekend. I need to only send somwhere me wife (hehe)
Marcin Grzejszczak
@marcingrzejszczak
Mar 07 2017 07:45
Out of the box
Ziemowit
@Ziemowit
Mar 07 2017 07:45
Out of the box I think.
Marcin Grzejszczak
@marcingrzejszczak
Mar 07 2017 07:45
hahaha :D
LIN
@magixsource
Mar 07 2017 07:46
studing..hahah
Marcin Grzejszczak
@marcingrzejszczak
Mar 07 2017 07:48
:+1:
there's a gitter channel if you have any questions https://gitter.im/spring-cloud/spring-cloud-pipelines
LIN
@magixsource
Mar 07 2017 07:55
amazing
Marcin Grzejszczak
@marcingrzejszczak
Mar 07 2017 07:56
amazing? it's really easy to start a new Gitter channel :D
LIN
@magixsource
Mar 07 2017 07:57
ok,join that room now
Marcin Grzejszczak
@marcingrzejszczak
Mar 07 2017 07:59
:+1: