配置文件是这样的
<?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-3.1.xsd
           http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
           http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
           http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd">
<!-- 指定数据源文件 -->
<context:property-placeholder location="classpath:jdbc.properties" />
<!-- 定义数据源 -->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName" value="${jdbc.driverClassName}" />
<property name="url" value="${jdbc.url}" />
<property name="username" value="${jdbc.username}" />
<property name="password" value="${jdbc.password}" />
<!-- 连接池启动时的初始值 -->
<property name="initialSize" value="${jdbc.initialSize}" />
<!-- 连接池的最大值 -->
<property name="maxActive" value="${jdbc.maxActive}" />
<!-- 最大空闲值.当经过一个高峰时间后,连接池可以慢慢将已经用不到的连接慢慢释放一部分,一直减少到maxIdle为止 -->
<property name="maxIdle" value="${jdbc.maxIdle}" />
<!-- 最小空闲值.当空闲的连接数少于阀值时,连接池就会预申请去一些连接,以免洪峰来时来不及申请 -->
<property name="minIdle" value="${jdbc.minIdle}" />
</bean>
<!-- 定义事务管理器 -->
<bean id="txManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource" />
</bean>
<!-- 指定事务管理器 -->
<tx:annotation-driven transaction-manager="txManager" />
<!-- 需要事务管理的类的设定 -->
<aop:config>
<!-- -->
<aop:pointcut id="transactionPointcut"
expression="(execution (* com.oletech.triangle.service.*.*(..))) or (execution (* com.oletech.triangle.dao.*.*(..))) or (execution (* gts.erpstd.productionSchedule.process.*.*(..))) or (execution (* gts.erpstd.service.*.*(..))) or (execution (* gts.erpstd.business.*.*(..)))" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="transactionPointcut" />
</aop:config>
<!-- 定义事务管理规则(建议Advice) -->
<tx:advice id="txAdvice" transaction-manager="txManager">
<tx:attributes>
<!-- 以get或query开头的方法不需要事务管理 -->
<tx:method name="get*" read-only="true" propagation="SUPPORTS" />
<tx:method name="query*" read-only="true" propagation="SUPPORTS" />
<tx:method name="validate*" read-only="true" propagation="SUPPORTS" />
<!-- 所有方法都要进行事务管理 -->
<tx:method name="*" propagation="REQUIRED" />
</tx:attributes>
</tx:advice> <!-- DAO -->
<!-- Base DAO -->
<bean id="baseDAO" class="com.oletech.triangle.dao.BaseDAO">
<property name="dataSource" ref="dataSource" />
</bean>
<!-- Log DAO -->
<bean id="logDAO" class="gts.erpstd.dao.LogDAO">
</bean> <!-- SynchronousData -->
<!-- Sender -->
<bean id="synchronousDataSender" class="com.oletech.triangle.synchronousData.SynchronousDataSender">
<property name="baseDAO" ref="baseDAO" />
</bean>
<!-- Receiver -->
<bean id="synchronousDataReceiver" class="com.oletech.triangle.synchronousData.SynchronousDataReceiver">
<property name="baseDAO" ref="baseDAO" />
</bean>
<!-- Service -->
<!-- Util Service -->
<bean id="utilService" class="com.oletech.triangle.service.UtilServiceImpl">
<property name="baseDAO" ref="baseDAO" />
</bean>
<!-- System Service -->
<bean id="systemService" class="com.oletech.triangle.service.SystemServiceImpl">
<property name="baseDAO" ref="baseDAO" />
</bean>
<!-- AS Service -->
<bean id="asService" class="com.oletech.triangle.service.ASServiceImpl">
<property name="baseDAO" ref="baseDAO" />
</bean>
<!-- View Service -->
<bean id="viewService" class="com.oletech.triangle.service.ViewServiceImpl">
<property name="baseDAO" ref="baseDAO" />
</bean>
<!-- Triangle Service -->
<bean id="triangleService" class="com.oletech.triangle.service.TriangleServiceImpl">
<property name="baseDAO" ref="baseDAO" />
</bean>
<!-- Select Page Service -->
<bean id="selectPageService" class="com.oletech.triangle.service.SelectPageServiceImpl">
<property name="baseDAO" ref="baseDAO" />
</bean>
<!-- Triangle Utils Service -->
<bean id="triangleUtilsService" class="com.oletech.triangle.service.TriangleUtilsServiceImpl">
<property name="baseDAO" ref="baseDAO" />
</bean>
<!-- File Service -->
<bean id="fileService" class="com.oletech.triangle.service.FileServiceImpl">
<property name="baseDAO" ref="baseDAO" />
</bean>
<!-- Log Service -->
<bean id="logService" class="com.oletech.triangle.service.LogServiceImpl">
<property name="logDAO" ref="logDAO" />
<property name="baseDAO" ref="baseDAO" />
</bean>


<!-- Triangle Service Delegation -->
<bean id="triangleServiceDelegation" class="com.oletech.triangle.utils.TriangleServiceDelegation">
<property name="utilService" ref="utilService" />
<property name="systemService" ref="systemService" />
<property name="asService" ref="asService" />
<property name="viewService" ref="viewService" />
<property name="triangleService" ref="triangleService" />
<property name="fileService" ref="fileService" />
<property name="logService" ref="logService" />
<property name="triangleUtilsService" ref="triangleUtilsService" />
</bean>
</beans>

解决方案 »

  1.   

    控制台报这样的错误,找半天我也不知道是哪里出了问题,求大神指导
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'itemMasterService' defined in ServletContext resource [/WEB-INF/config/applicationContext-erpstd.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'erpSTDBLBusinessDelegation' of bean class [gts.erpstd.service.ItemMasterServiceImpl]: Bean property 'erpSTDBLBusinessDelegation' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1396)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1118)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:385)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:284)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5118)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5634)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:899)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1260)
    at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:2002)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:724)
    Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'erpSTDBLBusinessDelegation' of bean class [gts.erpstd.service.ItemMasterServiceImpl]: Bean property 'erpSTDBLBusinessDelegation' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
    at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:1064)
    at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:924)
    at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:76)
    at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:58)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1393)
    ... 27 more
      

  2.   

     Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'erpSTDBLBusinessDelegation' of bean class [gts.erpstd.service.ItemMasterServiceImpl]:
    成员变量没有set方法?
      

  3.   

    Invalid property 'erpSTDBLBusinessDelegation' of bean class [gts.erpstd.service.ItemMasterServiceImpl]: Bean property 'erpSTDBLBusinessDelegation' is not writable or has an invalid setter method这不是说得很明白了吗?erpSTDBLBusinessDelegation  的  get/set  方法,检查下