level 1
z493612807
楼主
17:06:21,968 DEBUG http-80-2 support.DefaultListableBeanFactory:242 - Returning cached instance of singleton bean 'sessionFactory'
17:06:32,421 DEBUG http-80-2 support.DefaultListableBeanFactory:242 - Returning cached instance of singleton bean 'sessionFactory'
sessionFactory is null
17:06:32,453 DEBUG http-80-2 support.DefaultListableBeanFactory:242 - Returning cached instance of singleton bean 'sessionFactory'
发现sessionFactory 不自动注入.不知道是什么原因。
beans.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: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-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"
default-autowire="no">
<context:annotation-config/>
<context:component-scan base-package="bbs.dao"/>
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://localhost:3306/test"/>
<property name="username" value="root"/>
2010年09月30日 09点09分
1
17:06:32,421 DEBUG http-80-2 support.DefaultListableBeanFactory:242 - Returning cached instance of singleton bean 'sessionFactory'
sessionFactory is null
17:06:32,453 DEBUG http-80-2 support.DefaultListableBeanFactory:242 - Returning cached instance of singleton bean 'sessionFactory'
发现sessionFactory 不自动注入.不知道是什么原因。
beans.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: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-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"
default-autowire="no">
<context:annotation-config/>
<context:component-scan base-package="bbs.dao"/>
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://localhost:3306/test"/>
<property name="username" value="root"/>