为了账号安全,请及时绑定邮箱和手机立即绑定

请问一下,是不是我的配置哪里错了?出现了下面的错误报告。

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [applicationContext.xml]: Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: Pointcut is not well-formed: expecting '(' at character position 0

pointcut1

^


at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:532)

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:607)

at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)

at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)

at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)

at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)

at com.handan.test.AccountTest.test(AccountTest.java:29)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:597)

at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)

at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)

at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)

at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)

at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)

at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)

at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:73)

at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46)

at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)

at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)

at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)

at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)

at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)

at org.junit.runners.ParentRunner.run(ParentRunner.java:220)

at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)

at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

Caused by: java.lang.IllegalArgumentException: Pointcut is not well-formed: expecting '(' at character position 0

pointcut1

^


at org.aspectj.weaver.tools.PointcutParser.resolvePointcutExpression(PointcutParser.java:317)

at org.aspectj.weaver.tools.PointcutParser.parsePointcutExpression(PointcutParser.java:295)

at org.springframework.aop.aspectj.AspectJExpressionPointcut.buildPointcutExpression(AspectJExpressionPointcut.java:207)

at org.springframework.aop.aspectj.AspectJExpressionPointcut.buildPointcutExpression(AspectJExpressionPointcut.java:193)

at org.springframework.aop.aspectj.AspectJExpressionPointcut.checkReadyToMatch(AspectJExpressionPointcut.java:182)

at org.springframework.aop.aspectj.AspectJExpressionPointcut.getClassFilter(AspectJExpressionPointcut.java:163)

at org.springframework.aop.support.AopUtils.canApply(AopUtils.java:208)

at org.springframework.aop.support.AopUtils.canApply(AopUtils.java:262)

at org.springframework.aop.support.AopUtils.findAdvisorsThatCanApply(AopUtils.java:294)

at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findAdvisorsThatCanApply(AbstractAdvisorAutoProxyCreator.java:117)

at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findEligibleAdvisors(AbstractAdvisorAutoProxyCreator.java:87)

at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.getAdvicesAndAdvisorsForBean(AbstractAdvisorAutoProxyCreator.java:68)

at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.wrapIfNecessary(AbstractAutoProxyCreator.java:356)

at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:319)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:412)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1492)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:524)

... 35 more




代码:

<?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:tx="http://www.springframework.org/schema/tx"

xmlns:aop="http://www.springframework.org/schema/aop"

xmlns:context="http://www.springframework.org/schema/context"

xsi:schemaLocation="http://www.springframework.org/schema/beans 

http://www.springframework.org/schema/beans/spring-beans-2.0.xsd 

 http://www.springframework.org/schema/context

 http://www.springframework.org/schema/context/spring-context.xsd

http://www.springframework.org/schema/tx 

http://www.springframework.org/schema/tx/spring-tx.xsd 

http://www.springframework.org/schema/aop 

http://www.springframework.org/schema/aop/spring-aop.xsd">

        

        <!-- 引入外部的属性文件 -->

        <context:property-placeholder location="classpath:jdbc.properties"/>

        

        <!-- 配置c3p0的连接池 -->

        <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">

              <property name="driverClass" value="${jdbc.driverClass}"/>

              <property name="jdbcUrl" value="${jdbc.url}"/>

              <property name="user" value="${jdbc.username}"/>

              <property name="password" value="${jdbc.password}"/>

        </bean>

        

        <!-- 配置业务层类 -->

        <bean id="accountService" class="com.handan.service.AccountService">

              <property name="accountDao" ref="accountDao"></property>

        </bean>

        

        <!-- 配置Dao层类 -->

        <bean id="accountDao" class="com.handan.dao.AccountDaoImpl">

              <property name="dataSource" ref="dataSource"/>

        </bean>

        

        <!-- 配置事物管理器 -->

        <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">

             <property name="dataSource" ref="dataSource"/>

        </bean>

        

        <!-- 配置事物的通知(事物的增强) -->

        <tx:advice id="txAdvice" transaction-manager="transactionManager">

           <!-- 配置属性 -->

           <tx:attributes>

           <!-- 

               PROPAGATION 事物的传播行为

               ISOLATION   事物的隔离级别

               readOnly    只读(不可以进行修改等其他操作)

               rollback-for:发生哪些异常回滚

               no-rollback:发生哪些异常不回滚

               timeout :过期信息

            -->

               <tx:method name="tranfer" propagation="REQUIRED"/>

           </tx:attributes>

        </tx:advice>

        

        <!-- 配置切面 -->

        <aop:config>

           <aop:pointcut id="pointcut1" expression="execution(* com.handan.service.AccountService+.*(..))" />

           <aop:advisor advice-ref="txAdvice"  pointcut="pointcut1" />

        </aop:config>

       

        

</beans>


正在回答

1 回答

 <aop:advisor advice-ref="txAdvice"  pointcut="pointcut1" />

应该为:

 <aop:advisor advice-ref="txAdvice"  pointcut-ref="pointcut1" />


0 回复 有任何疑惑可以回复我~
#1

Heather1 提问者

谢谢,之后也发现了,真的是蠢死了。。。。
2016-08-31 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

请问一下,是不是我的配置哪里错了?出现了下面的错误报告。

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信