java 无法注入service_为什么service没有成功注入

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xmlns:context="http://www.springframework.org/schema/context"

xmlns:tx="http://www.springframework.org/schema/tx"

xsi:schemaLocation="http://www.springframework.org/schema/beans

http://www.springframework.org/schema/beans/spring-beans.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">

class="org.springframework.jdbc.datasource.DataSourceTransactionManager">

application-service.xml

xmlns="http://java.sun.com/xml/ns/javaee"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:schemaLocation="http://java.sun.com/xml/ns/javaee

http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

contextConfigLocation

classpath:application-*.xml

encodingFilter

org.springframework.web.filter.CharacterEncodingFilter

encoding

UTF-8

encodingFilter

/

org.springframework.web.context.ContextLoaderListener

dispatcherServlet

org.springframework.web.servlet.DispatcherServlet

contextConfigLocation

classpath:spring-mvc.xml

1

dispatcherServlet

/

web.xml

如上面,service配置和web配置我都正确配置了啊,然而一运行到controller就BeanCreationException错误,因为controller里面@Autowired的service报没有定义

Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [service.BlogService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency.

有没有大佬帮我解答一下啊,晕,搞了一天了还没查出是哪的问题????

controller

0aaf5a90ddc16b70a05dd4827de7d0f2.png

service

338851988e11e81e918ad5524e6b2544.png

目录结构

83266e1bd78b5f964535394745dea289.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值