我是阿帕奇骆驼队的新手,刚刚开始。我有一个spring boot(MVC)+mongodb项目已经运行良好,当我尝试将其与apache camel集成时,控制台上出现了异常。根据我对异常的理解,spring boot试图说我不能使用默认注释
@Component
当我使用
@ComponentScan(basePackages="packagePath")
在项目的其他任何地方,由于它是一个MVC架构,我有控制器、服务和;我无法忽略的存储库,请帮助我解决此问题。
控制台异常
启动ApplicationContext时出错。显示条件报告
在启用“调试”的情况下重新运行应用程序。2018-03-15 17:17:55.426
错误744---[主]o.s.boot。Spring应用程序
:应用程序运行失败
组织。springframework。豆子。工厂BeanDefinitionStoreException:失败
处理配置类的导入候选对象
[com.era.conf.ApplicationConfiguration];嵌套异常为
Java语言lang.IllegalStateException:无法计算上的条件
组织。阿帕奇。骆驼春天靴子健康HealthCheckRoutes自动配置
由于org/springframework/boot/bind/RelaxedPropertyResolver没有
建立确保您自己的配置不依赖于该类。
如果您在@ComponentScanning springframework,也可能发生这种情况
软件包(例如,如果您在默认软件包中放置了@ComponentScan
错误)在
组织。springframework。上下文注释。ConfigurationClassParser。processImports(ConfigurationClassParser.java:616)
~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]位于
组织。springframework。上下文注释。ConfigurationClassParser。ProcessDeferedImportSelectors(ConfigurationClassParser.java:548)
~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]位于
组织。springframework。上下文注释。ConfigurationClassParser。解析(ConfigurationClassParser.java:184)
~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]位于
组织。springframework。上下文注释。配置类后处理器。processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:316)
~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]位于
组织。springframework。上下文注释。配置类后处理器。后处理BeanDefinitionRegistry(ConfigurationClassPostProcessor.java:233)
~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]位于
组织。springframework。上下文支持后处理注册Legate。invokeBeanDefinitionRegistryPostProcessors(后处理器注册Legate.java:273)
~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]位于
组织。springframework。上下文支持后处理注册Legate。invokeBeanFactoryPostProcessors(后处理器注册Legate.java:93)
~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]位于
组织。springframework。上下文支持AbstractApplicationContext。invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:693)
~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]位于
组织。springframework。上下文支持AbstractApplicationContext。刷新(AbstractApplicationContext.java:531)
~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]位于
组织。springframework。靴子网状物servlet。上下文ServletWebServerApplicationContext。刷新(ServletWebServerApplicationContext.java:140)
~[spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]位于
组织。springframework。靴子SpringApplication。刷新(SpringApplication.java:752)
[spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]位于
组织。springframework。靴子SpringApplication。refreshContext(SpringApplication.java:388)
[spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]位于
组织。springframework。靴子SpringApplication。run(SpringApplication.java:327)
[spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]位于
组织。springframework。靴子SpringApplication。run(SpringApplication.java:1246)
[spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]位于
组织。springframework。靴子SpringApplication。运行(SpringApplication.java:1234)
[spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]位于
com。时代conf.ApplicationConfiguration。main(ApplicationConfiguration.java:12)
[类/:na]由:java引起。lang.IllegalStateException:无法
评估上的条件
组织。阿帕奇。骆驼春天靴子健康HealthCheckRoutes自动配置
由于org/springframework/boot/bind/RelaxedPropertyResolver没有
建立确保您自己的配置不依赖于该类。
如果您在@ComponentScanning springframework,也可能发生这种情况
软件包(例如,如果您在默认软件包中放置了@ComponentScan
错误)在
组织。springframework。靴子自动配置。条件SpringBootCondition。匹配(SpringBootCondition.java:55)
~[spring-boot-autoconfigure-2.0.0.RELEASE.jar:2.0.0.RELEASE]位于
组织。springframework。上下文注释。条件计算器。shouldSkip(ConditionEvaluator.java:109)
~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]位于
组织。springframework。上下文注释。ConfigurationClassParser。processConfigurationClass(ConfigurationClassParser.java:217)
~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]位于
组织。springframework。上下文注释。ConfigurationClassParser。processImports(ConfigurationClassParser.java:606)
~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]。。。15普通
由于以下原因而忽略了帧:java。lang.NoClassDefFoundError:
org/springframework/boot/bind/RelaxedPropertyResolver位于
组织。阿帕奇。骆驼春天靴子util。HierarchicalPropertiesEvaluator。isEnabled(HierarchicalPropertiesEvaluator.java:49)
~[camel-spring-boot-2.20.2.jar:2.20.2]at
组织。阿帕奇。骆驼春天靴子util。HierarchicalPropertiesEvaluator。评估(HierarchicalPropertieseEvaluator.java:42)
~[camel-spring-boot-2.20.2.jar:2.20.2]at
组织。阿帕奇。骆驼春天靴子util。GroupCondition。getMatchOutput(GroupCondition.java:40)
~[camel-spring-boot-2.20.2.jar:2.20.2]at
组织。springframework。靴子自动配置。条件SpringBootCondition。匹配(SpringBootCondition.java:47)
~[spring-boot-autoconfigure-2.0.0.RELEASE.jar:2.0.0.RELEASE]。。。18
由于以下原因而忽略了公共帧:java。lang.ClassNotFoundException:
组织。springframework。靴子绑定RelaxedPropertyResolver位于
Java语言网URLClassLoader。findClass(URLClassLoader.java:381)
~(na:1.8.0\u 102)at
Java语言lang.ClassLoader。loadClass(ClassLoader.java:424)~[na:1.8.0\u 102]
在太阳下。杂项。启动器$AppClassLoader。loadClass(Launcher.java:331)
~(na:1.8.0\u 102)at
Java语言lang.ClassLoader。loadClass(ClassLoader.java:357)~[na:1.8.0\u 102]
。。。省略22个公共框架
聚甲醛
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring-boot-starter</artifactId>
<version>2.20.2</version>
</dependency>
</dependencies>
应用程序配置
package com.era.conf;
@SpringBootApplication
@ComponentScan(basePackages = "com.era.controller")
public class ApplicationConfiguration {
public static void main(String[] args) throws Exception {
SpringApplication.run(ApplicationConfiguration.class, args);
}
}
EmailResponseController
package com.era.controller;
@RestController
@RequestMapping("/emailResponse")
@ComponentScan(basePackages = "com.era.service")
public class EmailResponseController {
@Autowired private EmailResponseService serv;
@RequestMapping("/read")
public EmailResponseModel ExchangeServerEmailsReader() {
return serv.ExchangeServerEmailsReader();
}
}
服务
package com.era.service;
@Service
@EnableMongoRepositories("com.era.repository")
public class EmailResponseServiceImpl implements EmailResponseService {
@Autowired private EmailResponseRepository repo;
@Override
public EmailResponseModel ExchangeServerEmailsReader() {
final EmailResponseModel emailModel = new EmailResponseModel();
emailModel.setEmail(readEmailsFromExchangeServer());
return repo.save(emailModel);
}
}
CamelRouteClass公司
package com.era.route;
@Component
public class CamelRouteClass extends RouteBuilder {
@Override
public void configure() throws Exception {
from("file:C://response?noop=true").to("file:C://response2");
}
}