raojiaolong@163.com před 2 roky
rodič
revize
80caf3e6f4
1 změnil soubory, kde provedl 11 přidání a 2 odebrání
  1. 11 2
      mhotel/src/applicationContext.xml

+ 11 - 2
mhotel/src/applicationContext.xml

@@ -6,12 +6,14 @@
        xmlns:context="http://www.springframework.org/schema/context"
        xmlns:jee="http://www.springframework.org/schema/jee"
        xmlns:tx="http://www.springframework.org/schema/tx"
+       xmlns:task="http://www.springframework.org/schema/task"
        xsi:schemaLocation="
         http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
         http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
         http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
         http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-4.0.xsd
-        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd">
+        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
+        http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd">
 
     <!-- <context:property-placeholder location="classpath:jdbc.properties" /> -->
     <!-- 设置需要进行Spring注解扫描的类包 -->
@@ -53,7 +55,6 @@
 
     </bean>
 
-
     <!-- 配置Jdbc模板 -->
     <bean id="namedParameterJdbcTemplate" class="org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate" scope="prototype">
         <constructor-arg ref="dataSource"></constructor-arg>
@@ -97,4 +98,12 @@
         <aop:advisor advice-ref="txAdvice" pointcut-ref="serviceOperation" />
     </aop:config>
 
+
+    <!-- 定时器  这个是定时器要调用方法的类 -->
+    <bean id="job1" class="com.happy.action.hotelCoupomAction" />
+    <!-- 定义调用对象和调用对象的方法   -->
+<!--    <task:scheduled-tasks>-->
+<!--        &lt;!&ndash; 调用的类job1调用类中的方法execute  这里表示的是每10秒执行一次 &ndash;&gt;-->
+<!--        <task:scheduled ref="job1" method="setCoupomStatus" cron="0/10 * * * * ?" />-->
+<!--    </task:scheduled-tasks>-->
 </beans>