- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我的 Hibernate Spring 项目有一些问题。我尝试添加一些限定符或更改基础包,但没有帮助。
错误
2015-11-08 11:20:33.176 INFO 9586 --- [ main] project.Main : Starting Main on localhost.localdomain with PID 9586 (/home/kristyna/Dokumenty/ProjectWeb/target/classes started by kristyna in /home/kristyna/Dokumenty/ProjectWeb)
2015-11-08 11:20:33.223 INFO 9586 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@75cd8043: startup date [Sun Nov 08 11:20:33 CET 2015]; root of context hierarchy
2015-11-08 11:20:34.072 INFO 9586 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Overriding bean definition for bean 'beanNameViewResolver': replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration; factoryMethodName=beanNameViewResolver; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/web/ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter; factoryMethodName=beanNameViewResolver; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter.class]]
2015-11-08 11:20:34.716 INFO 9586 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2015-11-08 11:20:34.964 INFO 9586 --- [ main] o.apache.catalina.core.StandardService : Starting service Tomcat
2015-11-08 11:20:34.965 INFO 9586 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.0.28
2015-11-08 11:20:35.120 INFO 9586 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2015-11-08 11:20:35.120 INFO 9586 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1902 ms
2015-11-08 11:20:35.778 INFO 9586 --- [ost-startStop-1] o.s.b.c.e.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
2015-11-08 11:20:35.783 INFO 9586 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2015-11-08 11:20:35.784 INFO 9586 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2015-11-08 11:20:35.852 WARN 9586 --- [ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'webController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void project.web.WebController.setServiceUserDao(project.dao.ServiceUserDao); nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [project.dao.ServiceUserDao] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1208)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:755)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:759)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:117)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:689)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:321)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:969)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:958)
at project.web.Application.run(Application.java:13)
at project.Main.main(Main.java:24)
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:497)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void project.web.WebController.setServiceUserDao(project.dao.ServiceUserDao); nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [project.dao.ServiceUserDao] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProcessor.java:649)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331)
... 22 common frames omitted
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [project.dao.ServiceUserDao] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:1301)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1047)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:942)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProcessor.java:606)
... 24 common frames omitted
2015-11-08 11:20:35.855 INFO 9586 --- [ main] o.apache.catalina.core.StandardService : Stopping service Tomcat
2015-11-08 11:20:35.866 INFO 9586 --- [ main] .b.l.ClasspathLoggingApplicationListener : Application failed to start with classpath: [file:/usr/java/jdk1.8.0_51/jre/lib/jfxswt.jar, file:/usr/java/jdk1.8.0_51/jre/lib/deploy.jar, file:/usr/java/jdk1.8.0_51/jre/lib/jce.jar, file:/usr/java/jdk1.8.0_51/jre/lib/charsets.jar, file:/usr/java/jdk1.8.0_51/jre/lib/plugin.jar, file:/usr/java/jdk1.8.0_51/jre/lib/rt.jar, file:/usr/java/jdk1.8.0_51/jre/lib/management-agent.jar, file:/usr/java/jdk1.8.0_51/jre/lib/resources.jar, file:/usr/java/jdk1.8.0_51/jre/lib/jsse.jar, file:/usr/java/jdk1.8.0_51/jre/lib/javaws.jar, file:/usr/java/jdk1.8.0_51/jre/lib/jfr.jar, file:/usr/java/jdk1.8.0_51/jre/lib/ext/cldrdata.jar, file:/usr/java/jdk1.8.0_51/jre/lib/ext/nashorn.jar, file:/usr/java/jdk1.8.0_51/jre/lib/ext/sunec.jar, file:/usr/java/jdk1.8.0_51/jre/lib/ext/dnsns.jar, file:/usr/java/jdk1.8.0_51/jre/lib/ext/jfxrt.jar, file:/usr/java/jdk1.8.0_51/jre/lib/ext/zipfs.jar, file:/usr/java/jdk1.8.0_51/jre/lib/ext/localedata.jar, file:/usr/java/jdk1.8.0_51/jre/lib/ext/sunpkcs11.jar, file:/usr/java/jdk1.8.0_51/jre/lib/ext/sunjce_provider.jar, file:/home/kristyna/Dokumenty/ProjectWeb/target/classes/, file:/home/kristyna/Dokumenty/ProjectWeb/lib/hibernate-jpa-2.0-api-1.0.1.Final.jar, file:/home/kristyna/Dokumenty/ProjectWeb/lib/hibernate-commons-annotations-4.0.2.Final.jar, file:/home/kristyna/Dokumenty/ProjectWeb/lib/antlr-2.7.7.jar, file:/home/kristyna/Dokumenty/ProjectWeb/lib/dom4j-1.6.1.jar, file:/home/kristyna/Dokumenty/ProjectWeb/lib/jboss-logging-3.1.0.GA.jar, file:/home/kristyna/Dokumenty/ProjectWeb/lib/javassist-3.15.0-GA.jar, file:/home/kristyna/Dokumenty/ProjectWeb/lib/hibernate-core-4.2.2.Final.jar, file:/home/kristyna/Dokumenty/ProjectWeb/lib/jboss-transaction-api_1.1_spec-1.0.1.Final.jar, file:/home/kristyna/.m2/repository/org/springframework/boot/spring-boot-starter-thymeleaf/1.2.7.RELEASE/spring-boot-starter-thymeleaf-1.2.7.RELEASE.jar, file:/home/kristyna/.m2/repository/org/springframework/boot/spring-boot-starter/1.2.7.RELEASE/spring-boot-starter-1.2.7.RELEASE.jar, file:/home/kristyna/.m2/repository/org/springframework/boot/spring-boot/1.2.7.RELEASE/spring-boot-1.2.7.RELEASE.jar, file:/home/kristyna/.m2/repository/org/springframework/spring-context/4.1.8.RELEASE/spring-context-4.1.8.RELEASE.jar, file:/home/kristyna/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/1.2.7.RELEASE/spring-boot-autoconfigure-1.2.7.RELEASE.jar, file:/home/kristyna/.m2/repository/org/springframework/boot/spring-boot-starter-logging/1.2.7.RELEASE/spring-boot-starter-logging-1.2.7.RELEASE.jar, file:/home/kristyna/.m2/repository/org/slf4j/jcl-over-slf4j/1.7.12/jcl-over-slf4j-1.7.12.jar, file:/home/kristyna/.m2/repository/org/slf4j/jul-to-slf4j/1.7.12/jul-to-slf4j-1.7.12.jar, file:/home/kristyna/.m2/repository/org/slf4j/log4j-over-slf4j/1.7.12/log4j-over-slf4j-1.7.12.jar, file:/home/kristyna/.m2/repository/ch/qos/logback/logback-classic/1.1.3/logback-classic-1.1.3.jar, file:/home/kristyna/.m2/repository/ch/qos/logback/logback-core/1.1.3/logback-core-1.1.3.jar, file:/home/kristyna/.m2/repository/org/yaml/snakeyaml/1.14/snakeyaml-1.14.jar, file:/home/kristyna/.m2/repository/org/springframework/boot/spring-boot-starter-web/1.2.7.RELEASE/spring-boot-starter-web-1.2.7.RELEASE.jar, file:/home/kristyna/.m2/repository/org/springframework/boot/spring-boot-starter-tomcat/1.2.7.RELEASE/spring-boot-starter-tomcat-1.2.7.RELEASE.jar, file:/home/kristyna/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/8.0.28/tomcat-embed-core-8.0.28.jar, file:/home/kristyna/.m2/repository/org/apache/tomcat/embed/tomcat-embed-el/8.0.28/tomcat-embed-el-8.0.28.jar, file:/home/kristyna/.m2/repository/org/apache/tomcat/embed/tomcat-embed-logging-juli/8.0.28/tomcat-embed-logging-juli-8.0.28.jar, file:/home/kristyna/.m2/repository/org/apache/tomcat/embed/tomcat-embed-websocket/8.0.28/tomcat-embed-websocket-8.0.28.jar, file:/home/kristyna/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.4.6/jackson-databind-2.4.6.jar, file:/home/kristyna/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.4.6/jackson-annotations-2.4.6.jar, file:/home/kristyna/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.4.6/jackson-core-2.4.6.jar, file:/home/kristyna/.m2/repository/org/hibernate/hibernate-validator/5.1.3.Final/hibernate-validator-5.1.3.Final.jar, file:/home/kristyna/.m2/repository/javax/validation/validation-api/1.1.0.Final/validation-api-1.1.0.Final.jar, file:/home/kristyna/.m2/repository/org/jboss/logging/jboss-logging/3.1.3.GA/jboss-logging-3.1.3.GA.jar, file:/home/kristyna/.m2/repository/com/fasterxml/classmate/1.0.0/classmate-1.0.0.jar, file:/home/kristyna/.m2/repository/org/springframework/spring-web/4.1.8.RELEASE/spring-web-4.1.8.RELEASE.jar, file:/home/kristyna/.m2/repository/org/springframework/spring-aop/4.1.8.RELEASE/spring-aop-4.1.8.RELEASE.jar, file:/home/kristyna/.m2/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar, file:/home/kristyna/.m2/repository/org/springframework/spring-webmvc/4.1.8.RELEASE/spring-webmvc-4.1.8.RELEASE.jar, file:/home/kristyna/.m2/repository/org/springframework/spring-expression/4.1.8.RELEASE/spring-expression-4.1.8.RELEASE.jar, file:/home/kristyna/.m2/repository/org/springframework/spring-core/4.1.8.RELEASE/spring-core-4.1.8.RELEASE.jar, file:/home/kristyna/.m2/repository/org/thymeleaf/thymeleaf-spring4/2.1.4.RELEASE/thymeleaf-spring4-2.1.4.RELEASE.jar, file:/home/kristyna/.m2/repository/org/thymeleaf/thymeleaf/2.1.4.RELEASE/thymeleaf-2.1.4.RELEASE.jar, file:/home/kristyna/.m2/repository/ognl/ognl/3.0.8/ognl-3.0.8.jar, file:/home/kristyna/.m2/repository/org/javassist/javassist/3.18.1-GA/javassist-3.18.1-GA.jar, file:/home/kristyna/.m2/repository/org/unbescape/unbescape/1.1.0.RELEASE/unbescape-1.1.0.RELEASE.jar, file:/home/kristyna/.m2/repository/org/slf4j/slf4j-api/1.7.12/slf4j-api-1.7.12.jar, file:/home/kristyna/.m2/repository/nz/net/ultraq/thymeleaf/thymeleaf-layout-dialect/1.2.9/thymeleaf-layout-dialect-1.2.9.jar, file:/home/kristyna/.m2/repository/org/apache/derby/derbyclient/10.12.1.1/derbyclient-10.12.1.1.jar, file:/home/kristyna/.m2/repository/org/springframework/spring-tx/4.1.6.RELEASE/spring-tx-4.1.6.RELEASE.jar, file:/home/kristyna/.m2/repository/org/springframework/spring-beans/4.1.8.RELEASE/spring-beans-4.1.8.RELEASE.jar, file:/home/kristyna/Sta%c5%been%c3%a9/idea-IU-141.1532.4/lib/idea_rt.jar]
2015-11-08 11:20:35.869 INFO 9586 --- [ main] utoConfigurationReportLoggingInitializer :
Error starting ApplicationContext. To display the auto-configuration report enable debug logging (start with --debug)
2015-11-08 11:20:35.870 ERROR 9586 --- [ main] o.s.boot.SpringApplication : Application startup failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'webController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void project.web.WebController.setServiceUserDao(project.dao.ServiceUserDao); nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [project.dao.ServiceUserDao] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1208)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:755)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:759)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:117)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:689)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:321)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:969)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:958)
at project.web.Application.run(Application.java:13)
at project.Main.main(Main.java:24)
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:497)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void project.web.WebController.setServiceUserDao(project.dao.ServiceUserDao); nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [project.dao.ServiceUserDao] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProcessor.java:649)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331)
... 22 common frames omitted
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [project.dao.ServiceUserDao] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:1301)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1047)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:942)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProcessor.java:606)
... 24 common frames omitted
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'webController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void project.web.WebController.setServiceUserDao(project.dao.ServiceUserDao); nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [project.dao.ServiceUserDao] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1208)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:755)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:759)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:117)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:689)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:321)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:969)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:958)
at project.web.Application.run(Application.java:13)
at project.Main.main(Main.java:24)
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:497)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void project.web.WebController.setServiceUserDao(project.dao.ServiceUserDao); nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [project.dao.ServiceUserDao] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProcessor.java:649)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331)
... 22 more
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [project.dao.ServiceUserDao] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:1301)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1047)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:942)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProcessor.java:606)
... 24 more
Process finished with exit code 1
Controller
@Controller
public class WebController {
private ServiceUserDao serviceUserDaoImpl;
@Autowired
public void setServiceUserDao(ServiceUserDao serviceUserDaoImpl) {
this.serviceUserDaoImpl = serviceUserDaoImpl;
}
服务
@Service
public class ServiceUserDaoImpl implements ServiceUserDao {
UserDao userDao;
@Autowired
public void setServiceUserDao(UserDao userDao) {
this.userDao = userDao;
}
道
@Repository
public class UserDaoImpl implements UserDao {
private Session session;
public UserDaoImpl(){
this.session = Main.getSessionFactory().getCurrentSession();
session.beginTransaction();
}
我搜索了我的问题,但没有找到有用的东西。谢谢
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd">
<!-- Scan the JavaConfig -->
<context:annotation-config/>
<context:component-scan base-package="project" />
<aop:config proxy-target-class="true"/>
<bean
class="org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor"/>
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name = "sessionFactory" ref = "sessionFactory" />
</bean>
<tx:advice id="txAdvice">
<tx:attributes>
<tx:method name="*" propagation="REQUIRED" />
</tx:attributes>
</tx:advice>
<aop:config>
<aop:advisor pointcut="execution(* project..*.*(..))" advice-ref="txAdvice" />
</aop:config>
</beans>
最佳答案
你能验证 "project"
吗?里面<context:component-scan base-package="project" />
确实是包名,其中 @Service
小号,@Controller
类是?
解决 ServiceUserDao
后可能会遇到的另一个问题是你得到UserDaoImpl
无法 Autowiring 。这是因为您还没有启用对@Repository
的扫描。 .如果我没记错的话 <context:annotation-config/>
不是在扫描 JPA 内容。
所以尝试添加:
<beans:beans ...
...
xsi:schemaLocation="....
http://www.springframework.org/schema/data/jpa
http://www.springframework.org/schema/data/jpa/spring-jpa.xsd">
<!-- Scan @Repositories -->
<repositories base-package="xxx.repositories" />
关于java - NoSuchBeanDefinitionException : No qualifying bean of type [project. dao.ServiceUserDao] 找到依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33592471/
我正在获取 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'spring
我创建了一个库,用于在多个 Spring Boot 应用程序上共享代码。 该库包含一个 Repository 类 RequestRepository。将库添加到 Spring Boot 项目后,编译并
所以我尝试使用在另一个类中生成的 bean 以在主应用程序中使用 package com.simon.spring.basics.properties; import org.spri
我使用 spring-data-jpa。没有 Spring Boot。 package ru.spb.repository; public interface CrudUserRepository e
我尝试使用ClassPathXmlApplicationContext获取bean。但我收到:NoSuchBeanDefinitionException:未定义名为“newsController”的
请解释以下有关 Spring 中 NoSuchBeanDefinitionException 异常的信息: 是什么意思? 什么情况下会抛出? 我该如何预防? 这篇文章旨在对使用 Spring 的应用程
我刚刚使用 Spring Boot V1.3.5 设置了一个新项目,在尝试将存储库 Autowiring 到服务中时,我不断收到 NoSuchBeanDefinitionException 异常。这很
我在 Spring mvc 中遇到错误: (org.springframework.beans.factory.BeanCreationException:创建名称为“webController”的b
我正在使用 spring mvc 开发 Web 应用程序。我想将 spring bean 注入(inject)到我的 Servlet Filter 中。 我引用了这个教程http://www.dead
我们有一个(非 Web 应用程序)Spring 应用程序,在我们的 CruiseControl 持续集成 Linux 盒子上运行测试时会抛出 NoSuchBeanDefinitionException
我想在 BookRestController 中测试我的休息端点。我使用 @WebMvcTest 编写了一个测试。 @RunWith(SpringRunner.class) @WebMvcTest(B
我正在尝试按照官方教程开发我的第一个 Spring MVC 应用程序。我从模板创建了 MVC 项目,然后添加了以下 Spring Security 配置。 pom.xml: ... ...
我正在尝试使用 @RestClientTest 来测试休息客户端类。 据说: It will apply only configuration relevant to rest client test
我想使用ElasticSearch和Spring Data。我添加了此依赖项: org.springframework.boot spring-boot-starter-data-e
当我运行"grails dbm-update --dataSource=production"时,出现以下异常: org.springframework.beans.factory.NoSuchBea
我有一个 Java 桌面应用程序,它通过 Hibernate 连接到 MySql 数据库。 我有以下配置文件: pom.xml,我在其中放置了一些内容和数据库配置文件 [app_name]_conte
我有一个使用 Quartz 调度程序的 Spring Boot (2.1.3) 项目。它是通过启动器包含的: dependencies { ... implementation('or
我正在从事 Spring Hibernate 项目。如果我没有将 bean 名称与 @Repository 或 @Component 一起提及,我会收到错误“NoSuchBeanDefinitionE
我的多模块项目结构如下: project-example (parent) -- project-example-domain: contains DAOs and Services -- proje
我有一个 Spring Boot 应用程序。当我调用 context.getBean(MyController.class) 时,它工作正常。当我调用 context.getBean("MyContr
我是一名优秀的程序员,十分优秀!