ssm整合报的错误

街头诗人1 2017-07-21 10:14:23
qualifying bean of type [com.diandian.service.StudentService] 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)}
说我的bean没有注入进去我看了半天不知道怎么回事,求大神



...全文
166 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
20170421w 2017-07-21
  • 打赏
  • 举报
回复
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:task="http://www.springframework.org/schema/task" xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.2.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.2.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd"> <!-- 匹配属性地址 --> <context:property-placeholder location="classpath:db.properties"/> <!-- 组件扫描注解 --> <context:component-scan base-package="com.aisin"></context:component-scan> <!-- 配置数据源信息通过C3PO 方式连接 --> <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"> <property name="user" value="${db.username}"></property> <property name="driverClass" value="${db.driver}"></property> <property name="password" value="${db.password}"></property> <property name="jdbcUrl" value="${db.url}"></property> </bean> <!-- sqlSessionFactory --> <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> <!--mybatis主配置文件 --> <property name="configLocation" value="classpath:MapSqlConfig.xml"></property> <!-- 注入数据源 --> <property name="dataSource" ref="dataSource"></property> </bean> <!-- 扫描mapper代理对象 --> <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"> <!-- 扫描的mapper包路径 --> <property name="basePackage" value="com.aisin.mapper"></property> </bean> <!--<bean id="newsService" class="com.ssm.service.impl.NewsServiceImpl" /> --> <context:component-scan base-package="com.aisin.service.*"></context:component-scan> <context:annotation-config /> <task:annotation-driven/><!-- 使用的注解方式来实现Spring的定时任务 --> <!-- 开启这个配置,spring才能识别@Scheduled注解 --> <!-- <task:annotation-driven scheduler="qbScheduler" mode="proxy"/> <task:scheduler id="qbScheduler" pool-size="10"/> --> </beans>
街头诗人1 2017-07-21
  • 打赏
  • 举报
回复

67,512

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧