Context initialization failed org.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 method public java.lang.String com.cisetech.web.controller.savecontroller.SaveOnePeiceController.getOnePeiece() mapped.
寫定時器的時候出現這個錯誤,這麼配置各位看看有什麼錯嗎?java
<!-- 測試定時 -->web
<bean id="myTimer" class="com.cisetech.web.controller.savecontroller.SaveOnePeiceController"></bean>spring
<!-- 定時器配置 -->mvc
<bean id="timeDitail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">app
<property name="targetObject" ref="myTimer"></property><!-- 指定任務類 -->測試
<property name="targetMethod" value="demoTest"></property><!-- 指定任務方法 -->code
</bean>ci
<!-- 定義時間間隔觸發器 -->get
<bean id="timeTigger" class="org.springframework.scheduling.quartz.CronTriggerBean">servlet
<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>