Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot register to eureka server when spring.cloud.refresh.enabled is false #4235

Open
vladgon opened this issue Dec 23, 2023 · 5 comments
Open
Assignees

Comments

@vladgon
Copy link

vladgon commented Dec 23, 2023

mavenBom 'org.springframework.cloud:spring-cloud-dependencies:2023.0.0

According to

https://github.com/spring-cloud/spring-cloud-release/wiki/AOT-transformations-and-native-image-support and other documentation spring.cloud.refresh.enabled should be false when AOT compiling.

Application works fine when spring.cloud.refresh.enabled is true, but fails to register (registers with the port 0 ) when refresh is disabled

Server application.yaml

spring:
  application:
    name: demo-eureka-server

server:
  port: 8761

eureka:
  client:
    register-with-eureka: false
    fetch-registry: true

  dashboard:
    path: /dashboard

Client application.yaml

server:
  port: 0

spring:
  application:
    name: GreetingServer
  cloud:
    refresh:
      enabled: false
eureka:
  client:
    serviceUrl:
      defaultZone: http://localhost:8761/eureka
  instance:
    preferIpAddress: true
    status-page-url-path: '/'
    instance-id: ${spring.application.name}:${random.long[0,90000000000000000]}
    leaseExpirationDurationInSeconds: 1
    lease-renewal-interval-in-seconds: 1
@spencergibb spencergibb transferred this issue from spring-cloud/spring-cloud-release Dec 23, 2023
@OlgaMaciaszek
Copy link
Collaborator

Hello, @vladgon, thanks for reporting the issue. The premise for native images is the "closed world assumption", which for our purposes means that the application context and bean field values should not change at runtime, which is how the random port was being handled. Do you use the random port in your production applications?

@vladgon
Copy link
Author

vladgon commented Jan 22, 2024 via email

@OlgaMaciaszek
Copy link
Collaborator

We'll definitely be considering various implementation solutions. Please let us know if you use the random port feature in production or just for testing.

@vladgon
Copy link
Author

vladgon commented Jan 22, 2024 via email

@vladgon
Copy link
Author

vladgon commented Jan 22, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants