代码之家  ›  专栏  ›  技术社区  ›  Ankit Sharma

我正在尝试运行Eureka服务器,但无法运行它

  •  0
  • Ankit Sharma  · 技术社区  · 2 年前

    我从spring Initializer配置了Eureka服务器,并在eclipse中导入了它,但由于出现此错误,我无法运行服务器


    应用程序无法启动


    描述:

    组织中的字段应用程序信息管理器。springframework。云netflix。尤里卡。服务器EurekaServerAutoConfiguration需要“com”类型的bean。netflix。appinfo。找不到ApplicationInfo Manager。

    注入点具有以下注释: -@org。springframework。豆。工厂注释。自动连线(必需=真)

    行动:

    考虑定义COM类型的bean。netflix。appinfo。配置中的ApplicationInfo Manager。

    这是pom。xml::

    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <parent>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-parent</artifactId>
            <version>2.6.6</version>
            <relativePath/> <!-- lookup parent from repository -->
        </parent>
        <groupId>com.namingserver</groupId>
        <artifactId>naming-server</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <name>naming-server</name>
        <description>Demo project for Spring Boot</description>
        <properties>
            <java.version>1.8</java.version>
            <maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
            <spring-cloud.version>2021.0.1</spring-cloud.version>
        </properties>
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-actuator</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-starter-config</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
            </dependency>
    
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-devtools</artifactId>
                <scope>runtime</scope>
                <optional>true</optional>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-test</artifactId>
                <scope>test</scope>
            </dependency>
        </dependencies>
        <dependencyManagement>
            <dependencies>
                <dependency>
                    <groupId>org.springframework.cloud</groupId>
                    <artifactId>spring-cloud-dependencies</artifactId>
                    <version>${spring-cloud.version}</version>
                    <type>pom</type>
                    <scope>import</scope>
                </dependency>
            </dependencies>
        </dependencyManagement>
    
        <build>
            <plugins>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                </plugin>
            </plugins>
        </build>
    
    </project>
    

    这是应用程序。JAVA

    package com.namingserver.namingserver;
    
    import org.springframework.boot.SpringApplication;
    import org.springframework.boot.autoconfigure.SpringBootApplication;
    import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
    
    @SpringBootApplication
    @EnableEurekaServer
    public class NamingServerApplication {
    
        public static void main(String[] args) {
            SpringApplication.run(NamingServerApplication.class, args);
        }
    
    }
    
    0 回复  |  直到 2 年前