org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'paiMaiSerDaoImpl': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.dlsp.service.PaiMaiSerDao] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@javax.annotation.Resource(shareable=true, lookup=, name=, description=, authenticationType=CONTAINER, type=class java.lang.Object, mappedName=)}
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:306)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1122)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:522)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:626)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:389)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4842)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5303)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1407)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1397)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.dlsp.service.PaiMaiSerDao] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@javax.annotation.Resource(shareable=true, lookup=, name=, description=, authenticationType=CONTAINER, type=class java.lang.Object, mappedName=)}
at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:986)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:856)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:768)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.autowireResource(CommonAnnotationBeanPostProcessor.java:438)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.getResource(CommonAnnotationBeanPostProcessor.java:416)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor$ResourceElement.getResourceToInject(CommonAnnotationBeanPostProcessor.java:550)
at org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:150)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:303)
... 22 more
二月 24, 2017 11:03:25 上午 org.apache.catalina.core.StandardContext startInternal
严重: One or more listeners failed to start. Full details will be found in the appropriate container log file
二月 24, 2017 11:03:25 上午 org.apache.catalina.core.StandardContext startInternal
严重: Context [/ZuoYeXiangMu_3] startup failed due to previous errors
二月 24, 2017 11:03:25 上午 org.apache.catalina.core.ApplicationContext log
信息: Closing Spring root WebApplicationContext
二月 24, 2017 11:03:25 上午 org.apache.catalina.loader.WebappClassLoaderBase clearReferencesJdbc
警告: The web application [ZuoYeXiangMu_3] registered the JDBC driver [oracle.jdbc.OracleDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
二月 24, 2017 11:03:25 上午 org.apache.catalina.loader.WebappClassLoaderBase checkThreadLocalMapForLeaks
严重: The web application [ZuoYeXiangMu_3] created a ThreadLocal with key of type java.lang.ThreadLocal and a value of type java.lang.Class but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
二月 24, 2017 11:03:25 上午 org.apache.catalina.loader.WebappClassLoaderBase checkThreadLocalMapForLeaks
严重: The web application [ZuoYeXiangMu_3] created a ThreadLocal with key of type java.lang.ThreadLocal and a value of type java.lang.Class but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
二月 24, 2017 11:03:25 上午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["http-nio-8080"]
二月 24, 2017 11:03:25 上午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["ajp-nio-8009"]
二月 24, 2017 11:03:25 上午 org.apache.catalina.startup.Catalina start
信息: Server startup in 4212 ms
package com.dlsp.controller;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;
import java.util.Random;
import javax.annotation.Resource;
import javax.imageio.ImageIO;
import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.servlet.jsp.PageContext;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import com.dlsp.dao.UserLoginDao;
import com.dlsp.domain.Manage;
import com.dlsp.domain.Saleinfo;
import com.dlsp.service.PaiMaiSerDao;
import com.dlsp.service.UserLoginSerDao;
import com.dlsp.service.impl.PaiMaiSerDaoImpl;
import com.sun.java.swing.plaf.motif.resources.motif;
import com.sun.org.apache.regexp.internal.recompile;
@Controller
public class PaiMaicontroler {
@Resource
private PaiMaiSerDao paimai;
//获得随机颜色
Color getRandColor(int fc, int bc){
Random random = new Random();
if (fc > 255)
fc = 255;
if (bc > 255)
bc = 255;
int r = fc + random.nextInt(bc - fc);
int g = fc + random.nextInt(bc - fc);
int b = fc + random.nextInt(bc - fc);
return new Color(r, g, b);
}
//验证码
@RequestMapping("yanzheng.action")
public void yanzhengn(HttpServletRequest request,HttpServletResponse response,HttpSession session){
//设置页面不缓存
session=request.getSession();
response.setHeader("Pragma", "No-cache");
response.setHeader("Cache-Control", "no-cache");
response.setDateHeader("Expires", 0);
// 在内存中创建图象
int width = 60, height = 20;
BufferedImage image = new BufferedImage(width, height,
BufferedImage.TYPE_INT_RGB);
// 获取图形上下文
Graphics g = image.getGraphics();
//生成随机类
Random random = new Random();
// 设定背景色
g.setColor(getRandColor(200, 250));
g.fillRect(0, 0, width, height);
//设定字体
g.setFont(new Font("Times New Roman", Font.PLAIN, 18));
//画边框
//g.setColor(new Color());
//g.drawRect(0,0,width-1,height-1);
// 随机产生155条干扰线,使图象中的认证码不易被其它程序探测到
g.setColor(getRandColor(160, 200));
for (int i = 0; i < 155; i++) {
int x = random.nextInt(width);
int y = random.nextInt(height);
int xl = random.nextInt(12);
int yl = random.nextInt(12);
g.drawLine(x, y, x + xl, y + yl);
}
// 取随机产生的认证码(4位数字)
String sRand = "";
for (int i = 0; i < 4; i++) {
String rand = String.valueOf(random.nextInt(10));
sRand += rand;
// 将认证码显示到图象中
g.setColor(new Color(20 + random.nextInt(110), 20 + random
.nextInt(110), 20 + random.nextInt(110)));//调用函数出来的颜色相同,可能是因为种子太接近,所以只能直接生成
g.drawString(rand, 13 * i + 6, 16);
}
// 将认证码存入SESSION
session.setAttribute("numrand", sRand);
// 图象生效
g.dispose();
// 输出图象到页面
try {
ImageIO.write(image, "JPEG", response.getOutputStream());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//out.clear();
//out = PageContext.pushBody();
}
@RequestMapping("saleinfo.action")
public String getsuoyou(Model mo) {
List<Saleinfo> jihe = paimai.getall();
mo.addAttribute("jihe", jihe);
return "saleinfo";
}
@RequestMapping("addinfo.action")
public String addinfo(Saleinfo sale, Model mo) {
if (paimai.insertsale(sale) > 0) {
mo.addAttribute("cheng", 1);
} else {
mo.addAttribute("cheng", 2);
}
return "redirect:saleinfo.action";
}
@RequestMapping("update.action")
public String updateinfo(Saleinfo sale,Model mo){
if (paimai.updatedale(sale)>0) {
mo.addAttribute("gai", 1);
}else{
mo.addAttribute("gai", 2);
}
return "redirect:saleinfo.action";
}
@RequestMapping("sahn.action")
public String deleteinfo(int id,Model mo){
if (paimai.deletesale(id)>0) {
mo.addAttribute("shan", 1);
}else{
mo.addAttribute("shan", 2);
}
return "redirect:saleinfo.action";
}
}
package com.dlsp.controller;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;
import java.util.Random;
import javax.annotation.Resource;
import javax.imageio.ImageIO;
import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.servlet.jsp.PageContext;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import com.dlsp.dao.UserLoginDao;
import com.dlsp.domain.Manage;
import com.dlsp.domain.Saleinfo;
import com.dlsp.service.PaiMaiSerDao;
import com.dlsp.service.UserLoginSerDao;
import com.dlsp.service.impl.PaiMaiSerDaoImpl;
import com.sun.java.swing.plaf.motif.resources.motif;
import com.sun.org.apache.regexp.internal.recompile;
@Controller
public class PaiMaicontroler {
@Resource
private PaiMaiSerDao paimai;
//获得随机颜色
Color getRandColor(int fc, int bc){
Random random = new Random();
if (fc > 255)
fc = 255;
if (bc > 255)
bc = 255;
int r = fc + random.nextInt(bc - fc);
int g = fc + random.nextInt(bc - fc);
int b = fc + random.nextInt(bc - fc);
return new Color(r, g, b);
}
//验证码
@RequestMapping("yanzheng.action")
public void yanzhengn(HttpServletRequest request,HttpServletResponse response,HttpSession session){
//设置页面不缓存
session=request.getSession();
response.setHeader("Pragma", "No-cache");
response.setHeader("Cache-Control", "no-cache");
response.setDateHeader("Expires", 0);
// 在内存中创建图象
int width = 60, height = 20;
BufferedImage image = new BufferedImage(width, height,
BufferedImage.TYPE_INT_RGB);
// 获取图形上下文
Graphics g = image.getGraphics();
//生成随机类
Random random = new Random();
// 设定背景色
g.setColor(getRandColor(200, 250));
g.fillRect(0, 0, width, height);
//设定字体
g.setFont(new Font("Times New Roman", Font.PLAIN, 18));
//画边框
//g.setColor(new Color());
//g.drawRect(0,0,width-1,height-1);
// 随机产生155条干扰线,使图象中的认证码不易被其它程序探测到
g.setColor(getRandColor(160, 200));
for (int i = 0; i < 155; i++) {
int x = random.nextInt(width);
int y = random.nextInt(height);
int xl = random.nextInt(12);
int yl = random.nextInt(12);
g.drawLine(x, y, x + xl, y + yl);
}
// 取随机产生的认证码(4位数字)
String sRand = "";
for (int i = 0; i < 4; i++) {
String rand = String.valueOf(random.nextInt(10));
sRand += rand;
// 将认证码显示到图象中
g.setColor(new Color(20 + random.nextInt(110), 20 + random
.nextInt(110), 20 + random.nextInt(110)));//调用函数出来的颜色相同,可能是因为种子太接近,所以只能直接生成
g.drawString(rand, 13 * i + 6, 16);
}
// 将认证码存入SESSION
session.setAttribute("numrand", sRand);
// 图象生效
g.dispose();
// 输出图象到页面
try {
ImageIO.write(image, "JPEG", response.getOutputStream());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//out.clear();
//out = PageContext.pushBody();
}
@RequestMapping("saleinfo.action")
public String getsuoyou(Model mo) {
List<Saleinfo> jihe = paimai.getall();
mo.addAttribute("jihe", jihe);
return "saleinfo";
}
@RequestMapping("addinfo.action")
public String addinfo(Saleinfo sale, Model mo) {
if (paimai.insertsale(sale) > 0) {
mo.addAttribute("cheng", 1);
} else {
mo.addAttribute("cheng", 2);
}
return "redirect:saleinfo.action";
}
@RequestMapping("update.action")
public String updateinfo(Saleinfo sale,Model mo){
if (paimai.updatedale(sale)>0) {
mo.addAttribute("gai", 1);
}else{
mo.addAttribute("gai", 2);
}
return "redirect:saleinfo.action";
}
@RequestMapping("sahn.action")
public String deleteinfo(int id,Model mo){
if (paimai.deletesale(id)>0) {
mo.addAttribute("shan", 1);
}else{
mo.addAttribute("shan", 2);
}
return "redirect:saleinfo.action";
}
}
package com.dlsp.controller;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;
import java.util.Random;
import javax.annotation.Resource;
import javax.imageio.ImageIO;
import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.servlet.jsp.PageContext;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import com.dlsp.dao.UserLoginDao;
import com.dlsp.domain.Manage;
import com.dlsp.domain.Saleinfo;
import com.dlsp.service.PaiMaiSerDao;
import com.dlsp.service.UserLoginSerDao;
import com.dlsp.service.impl.PaiMaiSerDaoImpl;
import com.dlsp.service.impl.UserLoginService;
import com.sun.java.swing.plaf.motif.resources.motif;
import com.sun.org.apache.regexp.internal.recompile;
@Controller
public class UserLogincontroler {
@Resource
private UserLoginSerDao login;
@RequestMapping("admin.action")
public String asdsa(){
return "admin";
}
//普通登陆判断
@RequestMapping("dengdeng.action")
public String denglu(Manage ma,Model mo,String checkbox){
ma=login.loginman(ma);
if (!ma.equals("")) {
if (ma.getAdmin()==1) {
mo.addAttribute("user", ma);
if (!checkbox.equals("")) {
Cookie co=new Cookie("username", ma.getManame());
}
return "saleinfo";
}
return "admin";
}
return "admin";
}
//转换管理员登陆界面
@RequestMapping("denglu.action")
public String denglupan(Model mo){
mo.addAttribute("admin", "123123");
return "admin";
}
//转换普通用户登陆界面
@RequestMapping("dengluq.action")
public String denglupantwo(Model mo){
mo.addAttribute("admin", null);
return "admin";
}
}
package com.dlsp.controller;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;
import java.util.Random;
import javax.annotation.Resource;
import javax.imageio.ImageIO;
import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.servlet.jsp.PageContext;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import com.dlsp.dao.UserLoginDao;
import com.dlsp.domain.Manage;
import com.dlsp.domain.Saleinfo;
import com.dlsp.service.PaiMaiSerDao;
import com.dlsp.service.UserLoginSerDao;
import com.dlsp.service.impl.PaiMaiSerDaoImpl;
import com.dlsp.service.impl.UserLoginService;
import com.sun.java.swing.plaf.motif.resources.motif;
import com.sun.org.apache.regexp.internal.recompile;
@Controller
public class UserLogincontroler {
@Resource
private UserLoginSerDao login;
@RequestMapping("admin.action")
public String asdsa(){
return "admin";
}
//普通登陆判断
@RequestMapping("dengdeng.action")
public String denglu(Manage ma,Model mo,String checkbox){
ma=login.loginman(ma);
if (!ma.equals("")) {
if (ma.getAdmin()==1) {
mo.addAttribute("user", ma);
if (!checkbox.equals("")) {
Cookie co=new Cookie("username", ma.getManame());
}
return "saleinfo";
}
return "admin";
}
return "admin";
}
//转换管理员登陆界面
@RequestMapping("denglu.action")
public String denglupan(Model mo){
mo.addAttribute("admin", "123123");
return "admin";
}
//转换普通用户登陆界面
@RequestMapping("dengluq.action")
public String denglupantwo(Model mo){
mo.addAttribute("admin", null);
return "admin";
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
said,saname,startmoney,endmondey,starttime,endtime,panduan,remark
id,maname,password,cardnum,tell, dizhi,youzheng,admin
<!-- 基本的用户信息 -->
<resultMap id="paimaiMP" type="com.dlsp.domain.Saleinfo">
<id property="said" column="said" />
<result property="saname" column="saname" />
<result property="startmoney" column="startmoney" />
<result property="endmondey" column="endmondey" />
<result property="starttime" column="starttime" />
<result property="endtime" column="endtime" />
<result property="panduan" column="panduan" />
<result property="remark" column="remark" />
</resultMap>
<resultMap type="com.dlsp.domain.Manage" id="manageMP">
<id property="id" column="id" />
<result property="maname" column="maname" />
<result property="password" column="password" />
<result property="cardnum" column="cardnum" />
<result property="tell" column="tell" />
<result property="dizhi" column="dizhi" />
<result property="youzheng" column="youzheng" />
<result property="admin" column="admin" />
</resultMap>
<select id="getall" resultMap="paimaiMP" >
select <include refid="sale"/> from saleinfo
</select>
<select id="loginman" resultMap="manageMP">
select <include refid="man"/> from manage
</select>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<sql id="man">
id,maname,password,cardnum,tell, dizhi,youzheng,admin
</sql>
<resultMap type="com.dlsp.domain.Manage" id="manageMP">
<id property="id" column="id" />
<result property="maname" column="maname" />
<result property="password" column="password" />
<result property="cardnum" column="cardnum" />
<result property="tell" column="tell" />
<result property="dizhi" column="dizhi" />
<result property="youzheng" column="youzheng" />
<result property="admin" column="admin" />
</resultMap>
<select id="loginman" parameterType="com.dlsp.domain.Manage" resultType="com.dlsp.domain.Manage">
select <include refid="man"/> from manage
where maname=#{maname} and password=#{password}
</select>
package com.dlsp.service;
import java.util.List;
import com.dlsp.domain.Manage;
import com.dlsp.domain.Saleinfo;
public interface PaiMaiSerDao {
//查
List getall();
//增
int insertsale(Saleinfo sale);
//删
int deletesale(int id);
//改
int updatedale(Saleinfo sale);
}
package com.dlsp.service;
import com.dlsp.domain.Manage;
public interface UserLoginSerDao {
//登陆
Manage loginman(Manage manage);
}
package com.dlsp.service.impl;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.dlsp.dao.PaiMaiDao;
import com.dlsp.domain.Manage;
import com.dlsp.domain.Saleinfo;
import com.dlsp.service.PaiMaiSerDao;
@Service
public class PaiMaiSerDaoImpl implements PaiMaiSerDao {// 设置依赖的类
@Resource
private PaiMaiSerDao dao;
@Override
public List<Saleinfo> getall() {
return dao.getall();
}
@Override
public int insertsale(Saleinfo sale) {
return dao.insertsale(sale);
}
@Override
public int deletesale(int id) {
return dao.deletesale(id);
}
@Override
public int updatedale(Saleinfo sale) {
return dao.updatedale(sale);
}
}
package com.dlsp.service.impl;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.dlsp.dao.PaiMaiDao;
import com.dlsp.dao.UserLoginDao;
import com.dlsp.domain.Manage;
import com.dlsp.service.UserLoginSerDao;
@Service
public class UserLoginService implements UserLoginSerDao {
@Resource
private UserLoginSerDao dao;
@Override
public Manage loginman(Manage manage) {
return dao.loginman(manage);
}
}
<?xml version="1.0" encoding="UTF-8"?>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd"
>
<!-- 1.包扫描 service dao (注解方式) -->
<!-- 2. jdbc.properties 属性配置文件 -->
<context:property-placeholder location="classpath:jdbc.properties"/>
<!-- 3.数据源 -->
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="${jdbc.driverclass}"/>
<property name="url" value="${jdbc.url}"/>
<property name="username" value="${jdbc.username}"/>
<property name="password" value="${jdbc.password}"/>
</bean>
<!-- 4.sqlsessionfactory -->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<!-- 怎么和mybatis整合,关联Mybatis,关联映射文件 -->
<property name="configLocation" value="classpath:sqlMapConfig.xml"/>
<property name="mapperLocations" value="classpath:com/dlsp/dao/*.xml"/>
</bean>
<!-- 5.事务 -->
<bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"/>
</bean>
<tx:advice id="txAdvice" transaction-manager="txManager">
<tx:attributes>
<tx:method name="save*" propagation="REQUIRED"/>
<tx:method name="add*" propagation="REQUIRED"/>
<tx:method name="insert*" propagation="REQUIRED"/>
<tx:method name="update*" propagation="REQUIRED"/>
<tx:method name="delete*" propagation="REQUIRED"/>
<tx:method name="find*" read-only="true"/>
<tx:method name="get*" read-only="true"/>
<tx:method name="list*" read-only="true"/>
<tx:method name="*" read-only="true"/>
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut expression="execution(* com.dlsp.service.*.*(..))" id="txPointCut"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="txPointCut"/>
</aop:config>
Injection of resource dependencies failed,配置文件失败,或者对应的类没有注解spring
贴下Spring的配置文件。
Spring配置文件的问题,应该是注解没有找到PaiMaiSerDao
增加<context:component-scan base-package="com.dlsp.*"></context:component-scan>试试