浏览 3432 次
该帖已经被评为新手帖
|
|
---|---|
作者 | 正文 |
发表时间:2008-04-23
<?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: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.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd"> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"> <property name="driverClassName"> <value>com.mysql.jdbc.Driver</value> </property> <property name="url"> <value>jdbc:mysql://localhost:3306/wap</value> </property> <property name="username"> <value>root</value> </property> <property name="password"> <value>1234</value> </property> </bean> <bean id="mySessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource"> <ref bean="dataSource" /> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect"> org.hibernate.dialect.MySQLDialect </prop> <prop key="hibernate.show_sql">true</prop> </props> </property> <property name="mappingResources"> <list> <value>com/model/User.hbm.xml</value> <value>com/model/Userinfo.hbm.xml</value> <value>com/model/Shangping.hbm.xml</value> <value>com/model/Gouwuche.hbm.xml</value> </list> </property></bean> <bean id="dao" abstract="true" > <property name="sessionFactory"><ref local="mySessionFactory"/></property> </bean> <tx:advice id="txAdvice" transaction-manager="transactionManager" > <tx:attributes> <tx:method name="add*"/> <tx:method name="get*" read-only="true"/> </tx:attributes> </tx:advice> <aop:config> <aop:pointcut id="txAdvicePointcut" expression="execution(public com.services.impl.*(..) )"/> <aop:advisor pointcut-ref="txAdvice" advice-ref="txAdvicePointcut" /> </aop:config> <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory" ref="mySessionFactory"/> </bean> <bean id="userDao" class="com.dao.impl.UserDaoImpl" parent="dao" /> <bean id="userService" class="com.services.impl.UserServiceImpl" > <property name="userDao" ><ref local="userDao"/> </property> </bean> <bean id="shangpingDao" class="com.dao.impl.ShangpingDaoImpl" parent="dao" /> <bean id="gouwucheDao" class="com.dao.impl.GouwucheDaoImpl" parent="dao"></bean> <bean id="shoppingService" class="com.services.impl.ShoppingServiceImpl"> <property name="shangpingDao"><ref local="shangpingDao"/> </property> <property name="gouwucheDao"><ref local="gouwucheDao"/></property> </bean> </beans> [org.hibernate.impl.SessionFactoryObjectFactory] - <Not binding factory to JNDI, no JNDI name configured> 2008-04-23 16:12:13,593 DEBUG [org.hibernate.impl.SessionFactoryImpl] - <instantiated session factory> 2008-04-23 16:12:13,593 DEBUG [org.hibernate.impl.SessionFactoryImpl] - <Checking 0 named HQL queries> 2008-04-23 16:12:13,593 DEBUG [org.hibernate.impl.SessionFactoryImpl] - <Checking 0 named SQL queries> 2008-04-23 16:12:13,640 DEBUG [org.springframework.core.CollectionFactory] - <Creating [java.util.LinkedHashSet]> 2008-04-23 16:12:13,656 INFO [org.springframework.orm.hibernate3.HibernateTransactionManager] - <Using DataSource [org.apache.commons.dbcp.BasicDataSource@1a4ded3] of Hibernate SessionFactory for HibernateTransactionManager> 2008-04-23 16:12:13,656 DEBUG [org.springframework.core.CollectionFactory] - <Creating [java.util.LinkedHashSet]> 2008-04-23 16:12:13,656 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - <Creating instance of bean '(inner bean)' with merged definition [Root bean: class [org.springframework.transaction.interceptor.NameMatchTransactionAttributeSource]; scope=singleton; abstract=false; lazyInit=false; autowireCandidate=true; autowireMode=0; dependencyCheck=0; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null]> 2008-04-23 16:12:13,656 DEBUG [org.springframework.beans.CachedIntrospectionResults] - <Getting BeanInfo for class [org.springframework.transaction.interceptor.NameMatchTransactionAttributeSource]> 2008-04-23 16:12:13,656 DEBUG [org.springframework.beans.CachedIntrospectionResults] - <Caching PropertyDescriptors for class [org.springframework.transaction.interceptor.NameMatchTransactionAttributeSource]> 2008-04-23 16:12:13,656 DEBUG [org.springframework.beans.CachedIntrospectionResults] - <Found bean property 'class' of type [java.lang.Class]> 2008-04-23 16:12:13,656 DEBUG [org.springframework.beans.CachedIntrospectionResults] - <Found bean property 'nameMap' of type [java.util.Map]> 2008-04-23 16:12:13,656 DEBUG [org.springframework.beans.CachedIntrospectionResults] - <Found bean property 'properties' of type [java.util.Properties]> 2008-04-23 16:12:13,656 DEBUG [org.springframework.core.CollectionFactory] - <Creating [java.util.LinkedHashMap]> 2008-04-23 16:12:13,656 DEBUG [org.springframework.core.CollectionFactory] - <Creating [java.util.LinkedHashMap]> 2008-04-23 16:12:13,656 DEBUG [org.springframework.transaction.interceptor.NameMatchTransactionAttributeSource] - <Adding transactional method [add*] with attribute [PROPAGATION_REQUIRED,ISOLATION_DEFAULT]> 2008-04-23 16:12:13,656 DEBUG [org.springframework.transaction.interceptor.NameMatchTransactionAttributeSource] - <Adding transactional method [get*] with attribute [PROPAGATION_REQUIRED,ISOLATION_DEFAULT,readOnly]> 2008-04-23 16:12:13,656 DEBUG [org.springframework.core.CollectionFactory] - <Creating [java.util.LinkedHashSet]> 2008-04-23 16:12:13,656 DEBUG [org.springframework.core.CollectionFactory] - <Creating [java.util.LinkedHashSet]> 2008-04-23 16:12:13,671 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - <Retrieved dependent beans for bean 'dataSource': [mySessionFactory]> 2008-04-23 16:12:13,671 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - <Retrieved dependent beans for bean 'mySessionFactory': [transactionManager]> 2008-04-23 16:12:13,671 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - <Retrieved dependent beans for bean 'transactionManager': [txAdvice]> 2008-04-23 16:12:13,671 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - <Retrieved dependent beans for bean 'txAdvice': [org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor]> 2008-04-23 16:12:13,671 DEBUG [org.springframework.beans.factory.support.DisposableBeanAdapter] - <Invoking destroy() on bean with name 'mySessionFactory'> 2008-04-23 16:12:13,671 INFO [org.springframework.orm.hibernate3.LocalSessionFactoryBean] - <Closing Hibernate SessionFactory> 2008-04-23 16:12:13,671 INFO [org.hibernate.impl.SessionFactoryImpl] - <closing> 2008-04-23 16:12:13,671 INFO [org.springframework.beans.factory.support.DefaultListableBeanFactory] - <Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@544ec1: defining beans [dataSource,mySessionFactory,dao,txAdvice,org.springframework.aop.config.internalAutoProxyCreator,txAdvicePointcut,org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor,transactionManager,userDao,userService,shangpingDao,gouwucheDao,shoppingService]; root of factory hierarchy> Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor': Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are: PropertyAccessException 1: org.springframework.beans.TypeMismatchException: Failed to convert property value of type [org.springframework.transaction.interceptor.TransactionInterceptor] to required type [org.springframework.aop.Pointcut] for property 'pointcut'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [org.springframework.transaction.interceptor.TransactionInterceptor] to required type [org.springframework.aop.Pointcut] for property 'pointcut': no matching editors or conversion strategy found Caused by: org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessException details (1) are: PropertyAccessException 1: org.springframework.beans.TypeMismatchException: Failed to convert property value of type [org.springframework.transaction.interceptor.TransactionInterceptor] to required type [org.springframework.aop.Pointcut] for property 'pointcut'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [org.springframework.transaction.interceptor.TransactionInterceptor] to required type [org.springframework.aop.Pointcut] for property 'pointcut': no matching editors or conversion strategy found Caused by: java.lang.IllegalArgumentException: Cannot convert value of type [org.springframework.transaction.interceptor.TransactionInterceptor] to required type [org.springframework.aop.Pointcut] for property 'pointcut': no matching editors or conversion strategy found at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:231) at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:138) at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:815) at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:645) at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:78) at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:59) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1122) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:857) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:423) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:249) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:155) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:246) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160) at org.springframework.aop.framework.autoproxy.BeanFactoryAdvisorRetrievalHelper.findAdvisorBeans(BeanFactoryAdvisorRetrievalHelper.java:87) at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findCandidateAdvisors(AbstractAdvisorAutoProxyCreator.java:96) at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findEligibleAdvisors(AbstractAdvisorAutoProxyCreator.java:83) at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.getAdvicesAndAdvisorsForBean(AbstractAdvisorAutoProxyCreator.java:66) at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:296) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:313) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1176) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:427) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:249) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:155) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:246) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:291) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352) at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:124) at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:68) at com.Test.main(Test.java:28) 应该有很多人会吧,我笨,请指点下。这里谢谢各位了 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |
发表时间:2008-09-19
我也遇到错误了。Error creating bean with name 'org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor'
|
|
返回顶楼 | |
发表时间:2008-09-21
<aop:advisor pointcut-ref="txAdvice" advice-ref="txAdvicePointcut" /> 这里配反了,应该是 :<aop:advisor pointcut-ref="txAdvicePointcut" advice-ref="txAdvice" /> |
|
返回顶楼 | |