下面是我的applicationContext.xml文件:<?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:p="http://www.springframework.org/schema/p" 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/aop http://www.springframework.org/schema/aop/spring-aop-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/context http://www.springframework.org/schema/context/spring-context-3.0.xsd " default-autowire="byName"> <context:property-placeholder location="classpath:db.properties"/> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"> <property name="driverClassName" value="${jdbc.driver}"></property> <property name="url" value="${jdbc.url}"></property> <property name="username" value="${jdbc.username}"></property> <property name="password" value="${jdbc.password}"></property> <property name="maxActive" value="50"></property> <property name="maxIdle" value="5"/> </bean> <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> <property name="dataSource" ref="dataSource"></property> <property name="configLocation" value="classpath:sqlMapConfig.xml" ></property> </bean> <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource" ref="dataSource"></property> </bean> <tx:advice id="adviceId" transaction-manager="transactionManager"> <tx:attributes> <tx:method name="save*" propagation="REQUIRED"/> </tx:attributes> </tx:advice> <aop:config> <aop:pointcut expression="execution (* com.winter.service.impl.*.*(..))" id="pointID"/> <aop:advisor advice-ref="adviceId" pointcut-ref="pointID"/> </aop:config> <bean name="users" class="com.winter.pojo.Users"> <property name="username" value="test2"></property> </bean> <bean name="usersMapper" class="org.mybatis.spring.SqlSessionFactoryBean"> <property name="sqlSessionFactory" value="sqlSessionFactory"></property> <property name="mapperInterface" value="com.winter.dao.UsersMapper"></property> </bean> <bean name="usersService" class="com.winter.service.impl.UsersServiceImpl"> <property name="usersMapper" ref="usersMapper"></property> </bean> <bean name="usersAction" class="com.winter.controller.UsersAction" scope="prototype"> <property name="usersService" ref="usersService"></property> </bean> </beans>求大神帮忙解决。。。
2 回答
vgbh
TA贡献17条经验 获得超2个赞
id为sqlSessionFactory的bean中,参数为configLocation的参数应该没有,不确定的话,去看看sqlSessionFactoryBean的源码
添加回答
举报
0/150
提交
取消