spring-mvc-config.xml

<context:component-scan base-package="com.bf" ></context:component-scan>

<task:annotation-driven />

<mvc:annotation-driven />

spring-core-config.xml

<context:component-scan base-package="com.bf" >
<context:exclude-filter expression="org.springframework.stereotype.Controller" type="annotation"/> <!--需要保留此声明,以便单元测试可用-->
</context:component-scan>

web.xml

<!-- For web context -->
<servlet>
<servlet-name>spring-dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring-mvc-config.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet> <servlet-mapping>
<servlet-name>spring-dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping> <!-- For root context -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener> <context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring-core-config.xml</param-value>
</context-param>
@Component
public class AutoService {
private static Logger logger = Logger.getLogger(AutoService.class);
@Autowired private MemberWechatService memberWechatService; /* cron表达式:
*(秒0-59)
*(分钟0-59)
*(小时0-23)
*(日期1-31)
*(月份1-12或是JAN-DEC)
*(星期1-7或是SUN-SAT) */ @Scheduled(cron = "0 32 * * * *") //每周日下午6:00
public void notifyTutor() {

Server.xml

<Host autoDeploy="true" name="localhost" unpackWARs="true">

这种配置可以定义执行。

但是以下配置方式,对事务是有效的,感觉事务与定时服务有冲突,没找到解决办法

spring-mvc-config.xml

<context:component-scan base-package="com.bf" use-default-filters="false">
<context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
</context:component-scan>

Spring MVC定时服务的更多相关文章

  1. Spring MVC Rest服务 返回json报406错误的解决办法

    @ResponseBody & @RequestBody @RequestBody 将 HTTP 请求正文插入方法中,使用适合的HttpMessageConverter将请求体写入某个对象. ...

  2. UEditor1.4.3.3整合Spring MVC和七牛

    [前言] 项目中涉及将UEditor上传服务器整合进已有的基于Spring MVC的服务中,并且将上传到本地改为上传到七牛,看似简单的一个需求,实际做起来还是遇到了一些困难.在这里分享一下经验-- 七 ...

  3. Spring MVC 设计概述

      MVC设计的根本原因在于解耦各个模块 Spring MVC的架构 对于持久层而言,随着软件发展,迁移数据库的可能性很小,所以在大部分情况下都用不到Hibernate的HQL来满足移植数据库的要求. ...

  4. 应用Spring MVC发布restful服务是怎样的一种体验

            摘要:“约定优于配置”这是一个相当棒的经验,SOAP服务性能差.基于配置.紧耦合,restful服务性能好.基于约定.松耦合,现在我就把使用Spring MVC发布restful服务的 ...

  5. spring mvc + freemarker优雅的实现邮件定时发送

    1. spring mvc工程中引入相关freemarker\mail的包 如:pom.xml中加入类似 <dependency> <groupId>javax.mail< ...

  6. JSR-303 Bean Validation 介绍及 Spring MVC 服务端参数验证最佳实践

    任何时候,当要处理一个应用程序的业务逻辑,数据校验是你必须要考虑和面对的事情. 应用程序必须通过某种手段来确保输入参数在上下文来说是正确的. 分层的应用很多时候同样的数据验证逻辑会出现在不同的层,这样 ...

  7. JSR-303 Bean Validation 介绍及 Spring MVC 服务端验证最佳实践

    任何时候,当要处理一个应用程序的业务逻辑,数据校验是你必须要考虑和面对的事情. 应用程序必须通过某种手段来确保输入参数在上下文来说是正确的. 分层的应用在很多时候,同样的数据验证逻辑会出现在不同的层, ...

  8. 译:7.使用Spring MVC服务Web内容

    本指南向您介绍了使用Spring创建“hello world”网站的过程.阅读原文:Serving Web Content with Spring MVC 1. 你将会构建什么? 您将构建一个具有静态 ...

  9. 关于使用spring mvc或者resteasy构建restful服务的差别与比较

    resteasy 是 jboss的一个开源java api for restful service(JSR 311,sun 2008年发布,最新GA版本是2.0, JAX-RS 2.0 (JSR-33 ...

随机推荐

  1. mui---父页面跳子页面刷新子页面

    最近在做项目,遇到一个问题,从父页面跳转到子页面,不会刷新子页面的问题. 解决方法:可以在跳转的时候,使用openWindow来进行跳转,接下来配置跳转打开页面的参数: 具体如下: mui.openW ...

  2. zabbix监控告警Received empty response from Zabbix Agent Assuming that agent dropped connection

    zabbix监控告警Received empty response from Zabbix Agent Assuming that agent dropped connection错误 查看zabbi ...

  3. 秒秒钟提高办公技巧的6个Excel技巧

    一.职工身份证号码是否登记重复(=IF(COUNTIF(B2:B13,B2&"*")>1,"重复","")) 职工列表人数众多 ...

  4. asp.net 访问页面访问统计实现 for iis7

    上一篇博文中< asp.net 访问页面访问统计实现  > 中在win10 (iis8+)上运行没有问题, 但客户机子是windows server 2008  的 iis7弄死不对,最好 ...

  5. sklearn的K折交叉验证函数KFold使用

    K折交叉验证时使用: KFold(n_split, shuffle, random_state) 参数:n_split:要划分的折数 shuffle: 每次都进行shuffle,测试集中折数的总和就是 ...

  6. Html吸顶效果

    Html吸顶效果 一.HTML HTML中需要给div一个id <!DOCTYPE html> <html lang="en"> <head> ...

  7. MyBatis中choose when正确写法

    <choose> <when test="scoreRange!=null and scoreRange eq 1"> AND sc.score <! ...

  8. Mysql thread 与 OS thread

    测试环境信息如下: OS:Ubuntu 16.04 LTS Mysql:Mysql 5.7.18,使用docker images运行的实例 Mysql如何处理client请求 在Mysql中,连接管理 ...

  9. [skill][debug][gdb] 使用core dump 进行GDB

    core dump 扫盲:https://wiki.archlinux.org/index.php/Core_dump 1.  人为制作 core dump 1.1  实时在线生成core dump. ...

  10. Copycat - AppendRequest

    对于Command,Configuration都要通过appendEntries的方式,把Entries同步给follower LeaderState.configure /** * Commits ...