Context initialization failedorg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping#0': Invocation of init method failed; nested exception is java.lang.IllegalStateException: Ambiguous mapping found. Cannot map 'saveOnePeiceController' bean method public java.lang.String com.cisetech.web.controller.savecontroller.SaveOnePeiceController.getOnePeiece()to {[/saveone/totest],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}: There is already 'myTimer' bean methodpublic java.lang.String com.cisetech.web.controller.savecontroller.SaveOnePeiceController.getOnePeiece() mapped.
写定时器的时候出现这个错误,这么配置各位看看有什么错吗?
<!-- 测试定时 -->
<bean id="myTimer" class="com.cisetech.web.controller.savecontroller.SaveOnePeiceController"></bean>
<!-- 定时器配置 -->
<bean id="timeDitail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject" ref="myTimer"></property><!-- 指定任务类 -->
<property name="targetMethod" value="demoTest"></property><!-- 指定任务方法 -->
</bean>
<!-- 定义时间间隔触发器 -->
<bean id="timeTigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail" ref="timeDitail"></property>
<property name="cronExpression">
<value>*/5 * * * * ?</value>
</property>
</bean>
<!-- 启动定时器 -->
<bean id="startJob" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="timeTigger"/>
</list>
</property>
</bean>