`
frank1998819
  • 浏览: 758669 次
  • 性别: Icon_minigender_1
  • 来自: 南京
文章分类
社区版块
存档分类

{@org.springframework.beans.factory.annotation.Autowired(required=true)}

 
阅读更多

Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [....Service] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
 at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:988)
 at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:858)
 at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:770)
 at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:486)
 ... 28 more

 

解决方法:
自动注入的时候,找不到对应的bean,因对应要注入的实现类没有加注解,DAO层用 @Repository ,Service层用 @Service

 

分享到:
评论

相关推荐

    org.springframework.test-3.0.2.RELEASE.jar

    import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @...

    Spring注解@Resource和@Autowired.doc

    首先,@Autowired 是 Spring 提供的注解,需要导入 org.springframework.beans.factory.annotation.Autowired 包。它可以在字段和 setter 方法上使用。如果同时在字段和 setter 方法上使用@Autowired,后者将会覆盖...

    spring_MVC源码

    14. <bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" /> 15. 16. <!-- 对模型视图名称的解析,即在模型视图名称添加前后缀 --> 17. <bean class="org....

    Spring In Action-2.1-01-@Component注解

    import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @...

    redis-lock-master.zip

    import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; import java....

    spring jdbctemplate 封裝

    import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.support.rowset.ResultSetWrappingSqlRowSet; import org....

    Spring3单元测试和集成测试

    import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; @ContextConfiguration(locations = {"classpath:spring-context.xml"}) public...

    动态的装配bean,注入到Controller中

    import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @Controller public class MyController { @Autowired private DynamicBean dynamicBean; ...

    SpringBoot中整合Mail实现简单邮件发送示例代码

    import org.springframework.beans.factory.annotation.Autowired; import org.springframework.mail.SimpleMailMessage; import org.springframework.mail.javamail.JavaMailSender; import org.springframework....

    基于java语言,springboot框架实现邮件发送.zip

    import org.springframework.beans.factory.annotation.Autowired; import org.springframework.mail.SimpleMailMessage; import org.springframework.mail.javamail.JavaMailSender; import org.spring...

    spring源码spring-framework-4.2.5.RELEASE

    在`org.springframework.beans.factory.annotation`包中,我们可以找到AutowiredAnnotationBeanPostProcessor,它是处理@Autowired注解的关键。 5. **@Service**、**@Repository**、**@Controller**:这些是Spring ...

    springboot发送邮件(含带附件的邮件,定时任务等功能)

    import org.springframework.beans.factory.annotation.Autowired; import org.springframework.mail.SimpleMailMessage; import org.springframework.mail.javamail.JavaMailSender; import org.springframework....

    SpringBoot中整合Mail实现发送带附件的邮件示例代码

    import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.spring...

    详解Spring依赖注入:@Autowired,@Resource和@Inject区别与实现原理

    Spring 依赖注入:@Autowired,@Resource 和@Inject 区别与实现原理 Spring 依赖注入是指在应用程序中将对象之间的依赖关系自动装配的过程。Spring 框架提供了多种依赖注入方式,包括 @Autowired、@Resource 和@...

    Java学习资料-springboot实现登录功能详细教程和代码

    import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; import ...

    springmvc项目搭建并实现Junit单元测试

    import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; ...

    Spring整合Redis完整实例代码

    import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; @Service public class ...

    基于java语言,springboot框架实现邮件发送.7z

    import org.springframework.beans.factory.annotation.Autowired; import org.springframework.mail.SimpleMailMessage; import org.springframework.mail.javamail.JavaMailSender; import org.springframework....

    springMVC-annotation注解介绍

    @Autowired为Spring提供的注解,需要导入包org.springframework.beans.factory.annotation.Autowired;只按照byType注入。 public class TestServiceImpl { // 下面两种@Autowired只要使用一种即可 @Autowired ...

    SpringBoot整合发送邮件

    import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.PropertySource; import org....

Global site tag (gtag.js) - Google Analytics