简体   繁体   English

没有 Spring 的 Java 应用程序上的 Eureka 服务器

[英]Eureka Server on Java application without Spring

I have java application (without Spring or Spring Boot) where server starts by invoking this method:我有 java 应用程序(没有 Spring 或 Spring 引导),其中服务器通过调用此方法启动:

 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 Server Eureka Clients will be Spring services so I can configure them. Eureka Clients将是 Spring 服务,因此我可以配置它们。

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?我看过很多教程如何使用 Spring 应用程序设置 Eureka Server,但我不知道如何使用非 Spring 应用程序来实现它?

Do I have to add manually below endpoints to the Eureka Server?我是否必须在端点下手动添加到 Eureka 服务器? https://github.com/Netflix/eureka/wiki/Eureka-REST-operations https://github.com/Netflix/eureka/wiki/Eureka-REST-operations

The Eureka Server is implemented as Jersey REST endpoints in a web application. Eureka 服务器在 web 应用程序中实现为 Jersey REST 端点。 It can be deployed as a WAR on any servlet container: Tomcat, JBoss, Jetty, etc.它可以作为 WAR 部署在任何 servlet 容器上:Tomcat、JBoss、Jetty 等。

You can build the WAR from the code at https://github.com/Netflix/eureka/eureka-server .您可以从https://github.com/Netflix/eureka/eureka-server的代码构建 WAR。

But the Java HTTP Server you are using does not support the servlet API, so you can't just add the WAR to it.但是您使用的Java HTTP Server不支持servlet API,所以不能只添加WAR。

  • Option 1: run it as a separate process on a standalone Tomcat/Jetty/...选项 1:在独立的 Tomcat/Jetty/... 上将其作为单独的进程运行
  • Option 2: add an Embedded Tomcat or Jetty in your main class (like Spring Boot does).选项 2:在您的主 class 中添加嵌入式 Tomcat 或 Jetty(就像 Spring 引导一样)。
  • Option 3: try to figure out how to map the Jersey REST endpoints in your HTTP Server?选项 3:尝试找出 map Jersey REST 端点在 Z293C9EA246FF9985DC6F62A6 中的方法

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在Spring Eureka服务器中检查应用程序状态 - How to check application status in Spring Eureka server Spring 引导应用程序在 Eureka 服务器中显示为未知 - Spring Boot Application shown as UNKNOWN in Eureka server 在 Spring 引导应用程序中启动 Eureka 服务器时出错 - Error While Starting Eureka Server in Spring Boot Application Spring 4应用程序注册为Eureka的客户 - Spring 4 application register as client to Eureka 带有配置服务器的 Spring Cloud Eureka - Spring Cloud Eureka with Config Server Spring Boot注册服务器(Eureka服务器) - Spring Boot Registration Server(Eureka Server) 如何在一个 Spring Boot 应用程序中的不同端口上运行 api-gateway(Netflix Zuul) 和 Eureka Server - How to run api-gateway(Netflix Zuul) and Eureka Server on different port in one Spring Boot application 如何使用尤里卡服务器在 spring 启动应用程序中禁用微服务实例? - how to disable an instance of micro-service in spring boot application using eureka server? Netflix Eureka Server 未使用 JDK 11 作为 Spring-Boot 应用程序启动。 但同样是在 JDK1.8 上运行 - Netflix Eureka Server Not starting as Spring-Boot Application with JDK 11 . But same is running with JDK1.8 Spring应用中Eureka健康检查的问题 - Problems with Eureka Health Checks in Spring Application
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM