<!--xmlns 多加下面的内容--> xmlns:task="http://www.springframework.org/schema/task"
<!--然后xsi:schemaLocation多加下面的内容--> http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.1.xsd
<!--最后是我们的task任务扫描注解--> <task:annotation-driven/>
<!--配置扫描位置--> <context:component-scan base-package="com.demot"/>
@Component
public class TaskScheduled { @Scheduled(cron="0 0 17 ? * 1-5")//每周1-5 下午5 点执行一次
public void myTest(){ System.out.println("发送短信"); } }