Search code examples
spring-bootmicroservicesspring-cloudspring-cloud-config

Problem with port determination using spring cloud


I have created 2 instances of a microservice named InfyGo_Flights. I have put a yaml file in git hub with server.port 9004. My properties file in MS is empty apart from application name. These 2 instances have 2 diff issues: 1.First I overrode in the config itself to take server.port as 9010. But still ran on 9004. I deleted the server.port in yaml in github. But this caused it to run into error. So replaced it with 9004 again. But now it has started running on 9010. Removing the overridden property causes it to run into error. 2.Second config I created after the first one was causing issue. But despite the yaml file in cloud config it runs on default 8080 port. application.properties:

spring.application.name=InfyGo_Flights

bootstrap.properties

spring.cloud.config.uri=http://localhost:1111

management.endpoints.web.exposure.include

InfyGo_Flights.yml

spring:
  application:
    name: InfyGo_Flights
  mvc:
    view:
      prefix: /WEB-INF/pages/
      suffix: .jsp      
 
  datasource:
    
    username: root
    password: 
    url: jdbc:mysql://localhost:3307/mydb?serverTimezone=UTC
  jpa:
      show-sql: true
      hibernate:
          ddl-auto: update
        
      properties:
        hibernate:
            dialect: 

logging:
  file: Errorlog.log
  level:
    root: info
    com.infoys.ars: info
  pattern:
    file: "%d{yyyy-MM-dd HH:mm:ss,SSS} %5p [%t] %c [%M] - %m%n"
server:
  port:9004

Solution

  • You will need to put a Whitespace between the port & 9004 so it get recognizable by the yaml file:

    //wrong
     port:9004
    //right
     port: 9004