Closed dldanjo closed 7 months ago
@dldanjo I took a stab at your request. Checkout https://github.com/ccheetham/Dockerfiles/tree/25-config-server-with-eureka
Note the change to the Dockerfile's http
Spring Initializr request that adds the Eureka client dependency (cloud-eureka
).
Is your feature request related to a problem? Please describe.
When using dockerfile to generate customize images, I saw the Annotation for EurekaClient was not added in my project. This way, I can not register it with Eureka. I tried to manipulate the "enableconfigserver.patch" but I didn't get.
Describe the solution you'd like
I would like to have an option to import EurekaClient for my project when using dockerfile.
Describe alternatives you've considered
Maybe is possible to create a new patch to add @EnableEurekaClient.
My example, but it didn't work.
--- a/src/main/java/io/steeltoe/docker/configserver/ConfigServer.java 2020-09-14 16:02:18.000000000 -0400 +++ b/src/main/java/io/steeltoe/docker/configserver/ConfigServer.java 2020-09-15 06:45:08.000000000 -0400 @@ -1,12 +1,21 @@ package io.steeltoe.docker.configserver;
import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.config.server.EnableConfigServer; +import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
@SpringBootApplication +@EnableConfigServer +@EnableEurekaClient public class ConfigServer {
public static void main(String[] args) { + System.setProperty("spring.config.name", "configserver"); + Package pkg = EnableConfigServer.class.getPackage(); + logger.info("{} {} by {}", pkg.getImplementationTitle(), pkg.getImplementationVersion(), pkg.getImplementationVendor()); + Package pkgEureka = EnableEurekaClient.class.getPackage(); +_ logger.info("{} {} by {}", pkgEureka.getImplementationTitle(), pkgEureka.getImplementationVersion(), pkgEureka.getImplementationVendor()); SpringApplication.run(ConfigServer.class, args); }
I put the character (_) together because the GIT was broken my example. But in code I didn't put this character.
Additional context
Add any other context, code snippets, or examples of the feature here.