nosuchfielderror:默认\u不兼容\u改进

mu0hgdu0  于 2021-07-05  发布在  Java
关注(0)|答案(0)|浏览(295)

在SpringBoot2.3.3上试用netflix hystrix时,出现以下错误-。。。

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'freeMarkerConfigurer' defined in org.springframework.cloud.netflix.hystrix.dashboard.HystrixDashboardConfiguration: Invocation of init method failed; nested exception is java.lang.NoSuchFieldError: DEFAULT_INCOMPATIBLE_IMPROVEMENTS

main simpleclientapplication.java有以下注解

@SpringBootApplication
@EnableCircuitBreaker
@EnableHystrixDashboard

productlistcontroller.java。。。

@RestController
@EnableAutoConfiguration(exclude = { FreeMarkerAutoConfiguration.class })
public class ProductListController {

    @GetMapping
    @HystrixCommand(fallbackMethod = "defaultProducts")
    public List<String> cloudProductList() {

        RestTemplate restTemplate = new RestTemplate();
        URI uri = URI.create("http://localhost:8090/products");

        return restTemplate.getForObject(uri, List.class);
    }

    public List<String> defaultProducts() {
        return Arrays.asList("Spring Cloud");
    }
}

pom.xml。。。
4.0.0 org.springframework.boot spring boot starter parent 2.3.3.release com.demo simple client application 1.0 simple client application spring boot演示项目

<properties>
        <java.version>14</java.version>
        <spring-cloud.version>Hoxton.SR8</spring-cloud.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
            <version>2.1.0.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-autoconfigure</artifactId>
        </dependency>
        <dependency>
            <groupId>freemarker</groupId>
            <artifactId>freemarker</artifactId>
            <version>2.3.9</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.junit.vintage</groupId>
                    <artifactId>junit-vintage-engine</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-netflix-hystrix</artifactId>
            <version>2.1.0.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.freemarker</groupId>
            <artifactId>freemarker</artifactId>
            <version>2.3.9</version>
        </dependency>
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjweaver</artifactId>
            <version>1.9.6</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-autoconfigure</artifactId>
            <version>2.3.3.RELEASE</version>
        </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>

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题