Spring Boot:无法在类org.springframework.cloud.netflix.zuul.ZuulConfiguration上内省带注释的方法

Spring Boot:无法在类org.springframework.cloud.netflix.zuul.ZuulConfiguration上内省带注释的方法,第1张

概述我试图将我的spring boot中的请求路由到另一台服务器.POM<?xml version='1.0'?> <project xmlns='http://maven.apache.org/POM/4.0.0' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:sc

我试图将我的spring boot中的请求路由到另一台服务器.

POM

Application.propertIEs

zuul.routes.foos.path=/r/users/**zuul.routes.foos.url=http://com.company.sws/c/users/

主类

@EnableZuulProxy@SpringBootApplication@ComponentScan@EnableautoConfigurationpublic class GatewayApplication {  public static voID main(String[] args) {    SpringApplication.run(GatewayApplication.class,args);  }}

启动应用程序时出现此错误

2017-06-20 09:13:42.720 ERROR 15296 --- [           main] o.s.boot.SpringApplication               : Application startup Failedorg.springframework.beans.factory.BeanDeFinitionStoreException: Failed to process import candIDates for configuration class [se.telenor.bAPIgateway.GatewayApplication]; nested exception is java.lang.IllegalStateException: Failed to introspect annotated methods on class org.springframework.cloud.netflix.zuul.ZuulConfiguration        at org.springframework.context.annotation.ConfigurationClassparser.processimports(ConfigurationClassparser.java:616)        at org.springframework.context.annotation.ConfigurationClassparser.doProcessConfigurationClass(ConfigurationClassparser.java:299)        at org.springframework.context.annotation.ConfigurationClassparser.processConfigurationClass(ConfigurationClassparser.java:245)        at org.springframework.context.annotation.ConfigurationClassparser.parse(ConfigurationClassparser.java:198)        at org.springframework.context.annotation.ConfigurationClassparser.parse(ConfigurationClassparser.java:167)        at org.springframework.context.annotation.ConfigurationClasspostProcessor.processConfigBeanDeFinitions(ConfigurationClasspostProcessor.java:308)        at org.springframework.context.annotation.ConfigurationClasspostProcessor.postProcessBeanDeFinitionRegistry(ConfigurationClasspostProcessor.java:228)        at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDeFinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:270)        at org.springframework.context.support.PostProcessorRegistrationDelegate.invokebeanfactoryPostProcessors(PostProcessorRegistrationDelegate.java:93)        at org.springframework.context.support.AbstractApplicationContext.invokebeanfactoryPostProcessors(AbstractApplicationContext.java:686)        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:524)        at org.springframework.boot.context.embedded.EmbeddeDWebApplicationContext.refresh(EmbeddeDWebApplicationContext.java:122)        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737)        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:370)        at org.springframework.boot.SpringApplication.run(SpringApplication.java:314)        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1162)        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1151)        at se.telenor.bAPIgateway.GatewayApplication.main(GatewayApplication.java:20)        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)        at java.lang.reflect.Method.invoke(Method.java:498)        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)        at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)        at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)        at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)Caused by: java.lang.IllegalStateException: Failed to introspect annotated methods on class org.springframework.cloud.netflix.zuul.ZuulConfiguration        at org.springframework.core.type.StandardAnnotationMetadata.getAnnotatedMethods(StandardAnnotationMetadata.java:163)        at org.springframework.context.annotation.ConfigurationClassparser.retrIEveBeanMethodMetadata(ConfigurationClassparser.java:380)        at org.springframework.context.annotation.ConfigurationClassparser.doProcessConfigurationClass(ConfigurationClassparser.java:314)        at org.springframework.context.annotation.ConfigurationClassparser.processConfigurationClass(ConfigurationClassparser.java:245)        at org.springframework.context.annotation.ConfigurationClassparser.processimports(ConfigurationClassparser.java:606)        ... 25 common frames omittedCaused by: java.lang.NoClassDefFoundError: org/springframework/boot/context/embedded/ServletRegistrationBean        at java.lang.class.getDeclaredMethods0(Native Method)        at java.lang.class.privateGetDeclaredMethods(Class.java:2701)        at java.lang.class.getDeclaredMethods(Class.java:1975)        at org.springframework.core.type.StandardAnnotationMetadata.getAnnotatedMethods(StandardAnnotationMetadata.java:152)        ... 29 common frames omittedCaused by: java.lang.classNotFoundException: org.springframework.boot.context.embedded.ServletRegistrationBean        at java.net.urlclassloader.findClass(urlclassloader.java:381)        at java.lang.classLoader.loadClass(ClassLoader.java:424)        at org.springframework.boot.loader.Launchedurlclassloader.loadClass(Launchedurlclassloader.java:94)        at java.lang.classLoader.loadClass(ClassLoader.java:357)
最佳答案org.springframework.boot.context.embedded.ServletRegistrationBean在spring-boot 1.4版中已弃用,并且引入了它的替代品org.springframework.boot.web.servlet.ServletRegistrationBean.已弃用的类已在spring-boot 1.5版中删除.您的应用程序或其中一个依赖项中的某些内容需要更新才能使用替换项. 总结

以上是内存溢出为你收集整理的Spring Boot:无法在类org.springframework.cloud.netflix.zuul.ZuulConfiguration上内省注释方法全部内容,希望文章能够帮你解决Spring Boot:无法在类org.springframework.cloud.netflix.zuul.ZuulConfiguration上内省带注释的方法所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/1260807.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-08
下一篇 2022-06-08

发表评论

登录后才能评论

评论列表(0条)