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

Jersey3DiscoveryClientOptionalArgs may be configured with TlsProperties in EurekaServerAutoConfiguration.java #4268

Closed
limo520 opened this issue Mar 12, 2024 · 5 comments · Fixed by #4285
Assignees
Labels
Milestone

Comments

@limo520
Copy link

limo520 commented Mar 12, 2024

When SSL for EurekaServer is enabled, I have to define my own jersey3DiscoveryClientOptionalArgs bean. It seems we can do this by default, as DiscoveryClientOptionalArgsConfiguration.java does.
DiscoveryClientOptionalArgsConfiguration.java is a part of spring-cloud-netflix-eureka-client, which is one dependency of spring-cloud-netflix-eureka-server. And it has already defined a TlsProperties bean too.

    @Bean
    @ConditionalOnMissingBean(AbstractDiscoveryClientOptionalArgs.class)
    public Jersey3DiscoveryClientOptionalArgs jersey3DiscoveryClientOptionalArgs(TlsProperties tlsProperties)
            throws GeneralSecurityException, IOException {
        Jersey3DiscoveryClientOptionalArgs optionalArgs = new Jersey3DiscoveryClientOptionalArgs();
        if (tlsProperties.isEnabled()) {
            SSLContextFactory factory = new SSLContextFactory(tlsProperties);
            optionalArgs.setSSLContext(factory.createSSLContext());
        }
        return optionalArgs;
    }
@limo520
Copy link
Author

limo520 commented Apr 2, 2024

The following class trys to do this , but it takes no effect currently.
org.springframework.cloud.netflix.eureka.config.DiscoveryClientOptionalArgsConfiguration$DiscoveryClientOptionalArgsTlsConfiguration

It seems that EurekaServerAutoConfiguration is registered after DiscoveryClientOptionalArgsTlsConfiguration, which results in failing to match @ConditionalOnBean(value = AbstractDiscoveryClientOptionalArgs.class, search = SearchStrategy.CURRENT) on DiscoveryClientOptionalArgsTlsConfiguration

@OlgaMaciaszek
Copy link
Collaborator

Hi @limo520, thanks for reporting the issue. Please provide a minimal, complete, verifiable example that reproduces the issue.

@limo520
Copy link
Author

limo520 commented Jun 27, 2024

@OlgaMaciaszek there is an example, https://github.com/limo520/spring-cloud-netflix-issues-4268

@OlgaMaciaszek
Copy link
Collaborator

Thanks, @limo520; so if I understand correctly, the scenario is to use TLS with the JerseyClient provided by EurekaServer for intra-peer EurekaServer communication, yes? And the Eureka Server's Jersey3DiscoveryClientOptionalArgs bean is created after DiscoveryClientOptionalArgsConfiguration's setup is processed, therefore it's not taken into account? Have added a draft solution that may address this. @spencergibb does this look ok to you?

@OlgaMaciaszek OlgaMaciaszek moved this to In Progress in 2023.0.3 Jun 28, 2024
@OlgaMaciaszek OlgaMaciaszek added this to the 4.1.3 milestone Jun 28, 2024
@limo520
Copy link
Author

limo520 commented Jun 28, 2024

@OlgaMaciaszek Yes, you are right. And when I wrote the example, I find another similar issue which can be reproduced by removing eureka.server.my-url in application.yml. It seems becuase of Jersey3ReplicationClient, but I haven't found it out.

@github-project-automation github-project-automation bot moved this from In Progress to Done in 2023.0.3 Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants