org/springframework/boot/bind/RelaxedPropertyResolver 未找到 [英] org/springframework/boot/bind/RelaxedPropertyResolver not found

查看:36
本文介绍了org/springframework/boot/bind/RelaxedPropertyResolver 未找到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 Spring Boot 项目中将 Apache Artemis 与 Apache Camel 连接起来.

I am trying to connect Apache Artemis with Apache Camel in Spring Boot project.

当我将 Spring Boot 版本从 1.5.9.RELEASE 升级到 2.2.2.RELEASE 时遇到问题.以下是我正在使用的 POM 和 Java 文件:

I am getting problem when I am upgrading my spring boot version from 1.5.9.RELEASE to 2.2.2.RELEASE. Below is my POM and Java files which I am using:

<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
            <modelVersion>4.0.0</modelVersion>
        
            <groupId>com.learncamel</groupId>
            <artifactId>activemq-learncamel-spring-boot</artifactId>
            <version>1.0.0-SNAPSHOT</version>
            <packaging>jar</packaging>
        
            <name>learncamel-spring-boot</name>
            <description>Demo project for Spring Boot</description>
        
            <parent>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-parent</artifactId>
                <version>1.5.9.RELEASE</version>
                <relativePath/> <!-- lookup parent from repository -->
            </parent>
        
            <properties>
                <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
                <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
                <java.version>1.8</java.version>
                <camel-version>2.20.1</camel-version>
            </properties>
        
            <dependencies>
                <dependency>
                    <groupId>org.apache.camel</groupId>
                    <artifactId>camel-spring-boot-starter</artifactId>
                    <version>2.20.1</version>
                </dependency>
        
                <dependency>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-web</artifactId>
                </dependency>
        
        
                <!--jdbc-->
                <dependency>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-jdbc</artifactId>
                    <version>1.5.9.RELEASE</version>
                </dependency>
        
                <dependency>
                    <groupId>org.apache.camel</groupId>
                    <artifactId>camel-jdbc</artifactId>
                    <version>${camel-version}</version>
                </dependency>
        
        
                <dependency>
                    <groupId>org.postgresql</groupId>
                    <artifactId>postgresql</artifactId>
                    <version>9.4.1212</version>
                </dependency>
        
        
        
                <!-- Lombok -->
                <dependency>
                    <groupId>org.projectlombok</groupId>
                    <artifactId>lombok</artifactId>
                    <version>1.16.20</version>
                    <scope>provided</scope>
                </dependency>
        
                <!-- EMail-->
                <dependency>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-mail</artifactId>
                    <version>1.4.3.RELEASE</version>
                </dependency>
        
        
                <!--activeMQ-->
                <dependency>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-activemq</artifactId>
                    <exclusions>
                        <exclusion>
                            <groupId>org.apache.activemq</groupId>
                            <artifactId>activemq-broker</artifactId>
                        </exclusion>
                    </exclusions>
                </dependency>
        
        
                <dependency>
                    <groupId>org.apache.activemq</groupId>
                    <artifactId>activemq-camel</artifactId>
                    <version>5.15.3</version>
                </dependency>
        
        
                <dependency>
                    <groupId>org.apache.camel</groupId>
                    <artifactId>camel-jms</artifactId>
                    <version>2.20.1</version>
                </dependency>
        
                <!--health Check-->
                <dependency>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-actuator</artifactId>
                </dependency>
        
                <dependency>
                    <groupId>org.apache.camel</groupId>
                    <artifactId>camel-http</artifactId>
                    <version>2.20.1</version>
                </dependency>
        
        
        
                <!--Test Dependencies-->
                <!--Camel Spring Test-->
                <dependency>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-test</artifactId>
                    <scope>test</scope>
                </dependency>
        
                <dependency>
                    <groupId>org.apache.camel</groupId>
                    <artifactId>camel-test-spring</artifactId>
                    <version>2.20.1</version>
                    <scope>test</scope>
                </dependency>
        
                <!--Clean Up directory-->
                <dependency>
                    <groupId>org.apache.commons</groupId>
                    <artifactId>commons-io</artifactId>
                    <version>1.3.2</version>
                </dependency>
        
        
            </dependencies>
        
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.springframework.boot</groupId>
                        <artifactId>spring-boot-maven-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
        
        
        </project>
    

当我将父版本升级到 2.2.2.RELEASE 时,它开始出现以下错误:-

When I am upgrading parent version to 2.2.2.RELEASE then it start giving below error:-

  Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
    21-06-2020 15:39:11.614 [main] ERROR o.s.boot.SpringApplication.reportFailure - Application run failed
    org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [com.learncamel.ActiveMQCamelApplication]; nested exception is java.lang.IllegalStateException: Could not evaluate condition on org.apache.camel.spring.boot.security.CamelSSLAutoConfiguration due to org/springframework/boot/bind/RelaxedPropertyResolver not found. Make sure your own configuration does not rely on that class. This can also happen if you are @ComponentScanning a springframework package (e.g. if you put a @ComponentScan in the default package by mistake)
        at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:597)
        at org.springframework.context.annotation.ConfigurationClassParser.access$900(ConfigurationClassParser.java:109)
        at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorGroupingHandler.lambda$processGroupImports$1(ConfigurationClassParser.java:805)
        at java.util.ArrayList.forEach(ArrayList.java:1257)
        at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorGroupingHandler.processGroupImports(ConfigurationClassParser.java:801)
        at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorHandler.process(ConfigurationClassParser.java:771)
        at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:188)
        at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:325)
        at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:242)
        at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:275)
        at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:95)
        at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:706)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:532)
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141)
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747)
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215)
        at com.learncamel.ActiveMQCamelApplication.main(ActiveMQCamelApplication.java:10)
    Caused by: java.lang.IllegalStateException: Could not evaluate condition on org.apache.camel.spring.boot.security.CamelSSLAutoConfiguration due to org/springframework/boot/bind/RelaxedPropertyResolver not found. Make sure your own configuration does not rely on that class. This can also happen if you are @ComponentScanning a springframework package (e.g. if you put a @ComponentScan in the default package by mistake)
        at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:54)
        at org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:108)
        at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:221)
        at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:587)
        ... 19 common frames omitted
    Caused by: java.lang.NoClassDefFoundError: org/springframework/boot/bind/RelaxedPropertyResolver
        at org.apache.camel.spring.boot.security.CamelSSLAutoConfiguration$Condition.getMatchOutcome(CamelSSLAutoConfiguration.java:51)
        at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:47)
        ... 22 common frames omitted
    Caused by: java.lang.ClassNotFoundException: org.springframework.boot.bind.RelaxedPropertyResolver
        at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        ... 24 common frames omitted
    
    Process finished with exit code 1
    

我正在使用以下 Java 文件:

I am using below Java files:

package com.learncamel.config;
        
        import org.apache.activemq.camel.component.ActiveMQComponent;
        import org.springframework.context.annotation.Bean;
        import org.springframework.context.annotation.Configuration;
        
        import javax.jms.ConnectionFactory;
        
        @Configuration
        public class ActiveMQConfig {
        
            @Bean(name="activemq")
            public ActiveMQComponent createComponent(ConnectionFactory  factory){
        
                ActiveMQComponent activeMQComponent = new ActiveMQComponent();
                activeMQComponent.setConnectionFactory(factory);
                return activeMQComponent;
        
            }
        }

另一个 Java 文件:

Another Java file:

package com.learncamel.routes;
        
        import org.apache.camel.builder.RouteBuilder;
        import org.springframework.stereotype.Component;
        
        @Component
        public class ActiveMQRoute extends RouteBuilder{
        
        
            @Override
            public void configure() throws Exception {
        
        
                from("{{fromRoute}}")
                            .log("Read Message from activemQ ${body}")
                        .to("{{toRoute}}");
        
                }
        }

推荐答案

由于混合 Spring 版本,可能会出现此类错误.

Such errors could arise because of mixed Spring versions.

做一个Maven 依赖树并检查混合的 Spring 版本(父 POM 和其他来自传递依赖项的版本之一.

Do a Maven dependency tree and check for mixed Spring versions (the one of the parent POM and other versions from transitive dependencies.

如果您的依赖树中有混合的 Spring 版本,请使用 依赖管理 或类似的 Maven 功能.

If you got mixed Spring versions in your dependency tree, fix them with dependency management or similar Maven features.

这篇关于org/springframework/boot/bind/RelaxedPropertyResolver 未找到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆