we3epar/target/classes/spring.xml

126 lines
4.9 KiB
XML
Raw Normal View History

2026-03-12 09:39:36 +08:00
<?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:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
">
<!--扫描加注解功能 -->
<context:component-scan base-package="com.we3e" />
<!-- 配置druid监控spring jdbc -->
<bean id="druid-stat-interceptor" class="com.alibaba.druid.support.spring.stat.DruidStatInterceptor">
</bean>
<bean id="druid-stat-pointcut" class="org.springframework.aop.support.JdkRegexpMethodPointcut" scope="prototype">
<property name="patterns">
<list>
<value>com.cdrcb.service.*</value>
</list>
</property>
</bean>
<aop:config>
<aop:advisor advice-ref="druid-stat-interceptor" pointcut-ref="druid-stat-pointcut" />
</aop:config>
<!-- 定式任务 -->
<!-- 启动触发器的配置开始 -->
<bean name="startQuertz" lazy-init="false" autowire="no" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="PushTrigger" />
<ref bean="PushTrigger2"/>
</list>
</property>
</bean>
<!-- 启动触发器的配置结束 -->
<!-- 调度的配置开始 -->
<!-- quartz-2.x的配置 -->
<bean id="PushTrigger"
class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<property name="jobDetail">
<ref bean="pushDetail" />
</property>
<property name="cronExpression">
<!-- s m h d m w(?) y(?) 秒>分>小时>日>月>周>年-->
<value>0 0/30 6-22 * * ?</value>
<!--<value>0/10 * 6-22 * * ?</value>-->
</property>
</bean>
<!-- 调度的配置结束 -->
<!-- job的配置开始 -->
<bean id="pushDetail"
class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject">
<ref bean="pushService" />
</property>
<property name="targetMethod">
<value>push</value>
</property>
</bean>
<!-- job的配置结束 -->
<!-- 调度的配置开始 -->
<!-- quartz-2.x的配置 -->
<bean id="PushTrigger2"
class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<property name="jobDetail">
<ref bean="pushDetail2" />
</property>
<property name="cronExpression">
<!-- s m h d m w(?) y(?) 秒>分>小时>日>月>周>年-->
<!--<value>0 0/30 6-22 * * ?</value>-->
<value>0 0/30 6-22 * * ?</value>
</property>
</bean>
<!-- 调度的配置结束 -->
<!-- job的配置开始 -->
<bean id="pushDetail2"
class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject">
<ref bean="pushService" />
</property>
<property name="targetMethod">
<value>pushHd</value>
</property>
</bean>
<!-- job的配置结束 -->
<!-- 工作的bean -->
<bean id="pushService" class="com.we3e.service.impl.PushServiceImpl" />
<bean id="myJob" class="com.we3e.service.impl.OrderServiceImpl">
</bean>
<!-- 配置JobDetail -->
<bean id="springQtzJobMethod" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<!-- 执行目标job -->
<property name="targetObject" ref="myJob"></property>
<!-- 要执行的方法 -->
<property name="targetMethod" value="oderNotify_1"></property>
</bean>
<!-- 配置tirgger触发器 -->
<bean id="cronTriggerFactoryBean" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<!-- jobDetail -->
<property name="jobDetail" ref="springQtzJobMethod"></property>
<!-- cron表达式执行时间 每10分钟执行一次 -->
<property name="cronExpression" value="0 0/10 * * * ?"></property>
</bean>
<!-- 配置调度工厂 -->
<bean id="springJobSchedulerFactoryBean" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="cronTriggerFactoryBean"></ref>
</list>
</property>
</bean>
</beans>