我正在使用Jhipster生成器主版本。
我添加了一个yo jhipster:entity collaborateur
的实体
一切顺利。
我已将项目导入Eclipse。
当我运行我的应用程序时,我收到此错误:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'collaborateurResource': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.myapp.rhapp.web.rest.mapper.CollaborateurMapper com.myapp.rhapp.web.rest.CollaborateurResource.collaborateurMapper; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.myapp.rhapp.web.rest.mapper.CollaborateurMapper] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@javax.inject.Inject()}
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766)
at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
at com.myapp.rhapp.rhappApp.main(rhappApp.java:70)
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.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.myapp.rhapp.web.rest.mapper.CollaborateurMapper com.myapp.rhapp.web.rest.CollaborateurResource.collaborateurMapper; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.myapp.rhapp.web.rest.mapper.CollaborateurMapper] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@javax.inject.Inject()}
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:573)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331)
... 20 common frames omitted
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.myapp.rhapp.web.rest.mapper.CollaborateurMapper] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@javax.inject.Inject()}
at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:1373)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1119)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1014)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:545)
... 22 common frames omitted
这是一个已知问题吗?我的项目配置有什么问题?
谢谢
[更新]
我用yo jhipster创建了一个项目
我跑了mvn compile
然后我跑了mvn
来启动项目(还没有使用eclipse)
我收到了这个错误:
java.lang.RuntimeException:java.net.BindException:Adressedéjà 在io.undertow.Undertow.start(Undertow.java:186)的utilisée org.springframework.boot.context.embedded.undertow.UndertowEmbeddedServletContainer.start(UndertowEmbeddedServletContainer.java:121) 在 org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.startEmbeddedServletContainer(EmbeddedWebApplicationContext.java:293) 在 org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:141) 在 org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541) 在 org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118) 在 org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766) 在 org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361) 在 org.springframework.boot.SpringApplication.run(SpringApplication.java:307) 在com.rhapp.rhapp.RhApp.main(RhApp.java:70)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 在 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 在java.lang.reflect.Method.invoke(Method.java:498)at org.springframework.boot.maven.AbstractRunMojo $ LaunchRunner.run(AbstractRunMojo.java:478) 在java.lang.Thread.run(Thread.java:745)引起: java.net.BindException:Adressedéjàutiliséeat sun.nio.ch.Net.bind0(Native Method)at sun.nio.ch.Net.bind(Net.java:433)at sun.nio.ch.Net.bind(Net.java:425)at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223) at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74) 在 org.xnio.nio.NioXnioWorker.createTcpConnectionServer(NioXnioWorker.java:190) 在 org.xnio.XnioWorker.createStreamConnectionServer(XnioWorker.java:243) 在io.undertow.Undertow.start(Undertow.java:142)... 15常见 框架省略
答案 0 :(得分:0)
DTO Mappers由MapStruct注释处理器生成,您可以先运行mvn compile
生成它们,并确保target/generated-sources
链接为Eclipse中的源文件夹。
http://jhipster.github.io/configuring-ide-eclipse/
http://jhipster.github.io/using-dtos/
或许有一种方法可以将Eclipse配置为自动运行MapStruct注释处理器。
<强>更新强>
您可以看到错误消息“Adressedéjàutilisée”,因此请查看您是否有另一个进程正在侦听端口8080(可能是Tomcat)并停止它并重新启动您的应用程序或编辑您的application-*.yml
,设置server.port
属性为8080以外的其他内容并重新启动您的应用。