janusz j
janusz j

Reputation: 329

Eureka Server on Java application without Spring

I have java application (without Spring or Spring Boot) where server starts by invoking this method:

 public void startServer() {
        com.sun.net.httpserver.HttpServer server = JdkHttpServerFactory.createHttpServer(address, resourceConfig, false);
        logger.info("HTTP: Start Http-Server. Adress: %s", address);
        server.start();
    }

I want this application to act as Eureka Server. Eureka Clients will be Spring services so I can configure them.

I have seen many tutorials how to setup Eureka Server with Spring application but I don't know how to implement it with non Spring app?

Do I have to add manually below endpoints to the Eureka Server? https://github.com/Netflix/eureka/wiki/Eureka-REST-operations

Upvotes: 0

Views: 392

Answers (1)

GeertPt
GeertPt

Reputation: 17846

The Eureka Server is implemented as Jersey REST endpoints in a web application. It can be deployed as a WAR on any servlet container: Tomcat, JBoss, Jetty, etc.

You can build the WAR from the code at https://github.com/Netflix/eureka/eureka-server.

But the Java HTTP Server you are using does not support the servlet API, so you can't just add the WAR to it.

  • Option 1: run it as a separate process on a standalone Tomcat/Jetty/...
  • Option 2: add an Embedded Tomcat or Jetty in your main class (like Spring Boot does).
  • Option 3: try to figure out how to map the Jersey REST endpoints in your HTTP Server?

Upvotes: 2

Related Questions