Home

Mockmvc spock

Mock Spring service in controller test using Spock - Stack

Spring @WebMvcTest with Spock Framework · allegro

How Spring MVC Tests Controller (Using Spring MVC mock Tests)

Spring boot MockMVC example with @WebMvcTest - HowToDoInJav

In this article, we've explained how to set up a Maven project to use Spock and the Spring Boot test framework combined. Furthermore, we have seen how both frameworks supplement each other perfectly. For a deeper dive, have a look to our tutorials about testing with Spring Boot , about the Spock framework and about the Groovy language Spock 1.2 adds support for exporting mocks from a Specification into an ApplicationContext. This was inspired by Spring Boot's @MockBean(realised via Mockito) but adapted to fit into Spock style. It does not require any Spring Boot dependencies, however it requires Spring Framework 4.3.5 or greater to work Firing up a Spring context allows us to validate HTTP pathing and method configuration using MockMVC. Our test would look something like this: Each one creates a Spock mock for the service it's interested in, and publishes that into the Spring context using a TestConfiguration. Each test makes a mock MVC call to the controller, verifying. MockMvc hits the sweet spot between slow integration tests and fast (relatively low-value) unit tests. You get the benefit of testing your fully functional REST layer without the overhead of.

Example of using Spock with Spring Boot's @MockMv

Using MockMVC with a Web Application Context - Conclusions. The most important difference of this approach is that we didn't need to explicitly load the surrounding logic since there is a partial Spring context in place. If we create new filters, new controller advices, or any other logic participating in the request-response process, we will. Mockmvc使用spock测试错误 时间:2018-04-11 05:31:06. 标签: spring testing controller spock 我正在使用spock框架为spring 3控制器类编写测试。尝试执行其中一个测试(GET请求)时出现以下错误。 请注意,同一个类中的所有其他测试(POST请求)都按预期工作。. Spock is a testing and specification framework for Java and Groovy applications. What makes it stand out from the crowd is its beautiful and highly expressive specification language. Thanks to its JUnit runner, Spock is compatible with most IDEs, build tools, and continuous integration servers 项目中需要单元测试用例,之前写的时候是通过junit +MockMvc,能够实现功能,但是语法及代码写起来好麻烦,后来查到了spock,并且看了一些用例,感觉语法上看起来很清晰,而且会更简便,于是就转头spock,话不多说,直刚代

Spock test with Mocks of Spring MVC Rest Controller using

Spring Framework 3.2 introduces a very elegant way to test Spring MVC controller using MockMvc. Based on the documentation, there are two ways to configure MockMvc:- MockMvcBuilders.webAppContextSetup(webApplicationContext).build() MockMvcBuilders.standaloneSetup(controller).build() The first approach will automatically load the Spring configuration and inject WebApplicationContext into the test 项目中需要单元测试用例,之前写的时候是通过junit +MockMvc,能够实现功能,但是语法及代码写起来好麻烦,后来查到了spock,并且看了一些用例,感觉语法上看起来很清晰,而且会更简便,于是就转头spock,话不多说,直刚代码 依赖引入 <dependency> <groupId>com.tngtech. Injecting Spock Mocks into the Spring Context DetachedMockFactory. If you want to use Spock mocks, the first thing you'll need to do is make sure you're on Spock version 1.1 or higher. This version introduced the ability to define mocks outside of a Spock Specification via the DetachedMockFactory

Test-Driven Development Process: Add a Test. Run all tests and see if the any fails. Update code. Run tests and Refactor code. Repeat the same process. To implement TDD, we will need Unit tests which focus on every small functionality of the application. Let's move to what is UNIT TESTING and why it is necessary package org.mycompany.tests import org.mycompany.ExampleSpringController import com.jayway.restassured.module.mockmvc.RestAssuredMockMvc import spock.lang.Specification class MvcSpec extends Specification { def setup() { RestAssuredMockMvc.standaloneSetup(new ExampleSpringController()) } } You can also setup the whole context if necessary In this mockito tutorial, learn about mockito annotations such as @Mock, @Spy, @Captor, @InjectMocks.Learn to write unit tests for behavior testing using mockito annotations. 1. Mockito annotations 1.1. @Moc

Spocklight: Use Stub or Mock For Spring Component Using

MockMVCとは. アプリケーションサーバにデプロイすることなく、Spring MVCの動作を再現することができます。MockMVCを使うことでコントローラのテストを簡単に作成できます。 Spring BootでMockMVCを使うためにはbuild.gradleに以下の記述を追加します Spring Boot + Spockのテストで必要なライブラリを追加します。spock-coreへの依存を書いておくことで、Groovy周りのライブラリも一緒に落ちてきます。また、spock-springがないとSpock(Groovy)の中で@Autowired等が使えないので、必要であればこれも追加しておきます

Template project for API development with Java, Jetty, SpringMVC, Spock, Swagger and Heroku Gradle plugins Dependencies Embedded jetty SpringMVC Jackson JSON Log4j2 with async logging Log4j configuration Lombok Unit testing spring-test spock BDD testing framework Server launcher Gradle mainClassName SpringMVC context Server Context web.xml. If you want to use Spock in your projects, you must separately add the spock-core and spock-spring modules. See Spock's documnetation for more information: 2. Add Gradle Plugin with Dependencies By default, the mode is MockMvc, which is based on Spring's MockMvc. It can also be changed to WebTestClient, JaxRsClient, or Explicit (for.

MockMvc will work with templating technologies that do not rely on a Servlet Container (i.e. Thymeleaf, Freemarker, Velocity, etc). It does not work with JSPs since they rely on the Servlet Container. Table of Contents. 1. Why Spring MVC Test HtmlUnit? geb-spock:0.10.0 testCompile org.spockframework:spock-spring:1.-groovy-2.4 }. simple spock + spring mvc test. GitHub Gist: instantly share code, notes, and snippets Spock for Integration Testing (like Rest Services) and for Functional Testing (with Selenium): We explored about Mocking, Stubbing and Spying in Spock in our previous tutorial.. In this Full Training Tutorial Series on Spock, so far we covered, writing unit tests using the Spock framework. Unit tests, typically test a single class with all the integration points or external calls are being. spring junit mockito spock mockmvc Publisert på 05/12/2014 klokken 01:52 2014-12-05 01:52 kilden bruker tehra Mockmvc bruke spock test feil. stemmer . 0 . Jeg bruker Spock rammeverk for å skrive tester for en fjær 3-kontrolleren klasse. Jeg får følgende feilmelding mens du prøver å utføre en av testene (GET forespørsel). Merk at alle andre tester (POST-forespørsler) i samme klasse fungerer som forventet

Using MockMvc provides a faster way of testing MVC controllers like the PersonRestController, as it removes the need to fully start an HTTP server. 7. 1 @Test. 2 This example shows how to unit test Spring File upload controller by using MockMultipartFile.. MockMultipartFile does not use the application registered MultipartResolver, that means it is only suitable for testing application controllers that access multipart uploads.. Example The Controller @Controller @RequestMapping(/upload) public class FileUploadController { public static final String. 上面的代碼基於帶有MockMvc內容的Spock框架。 所有安全性檢查都通過了,因此Spring安全性設置已經完成,但是最后應該調用控制器,但是失敗並顯示404狀態,即找不到資源(這是映射的控制器方法) You might get NullPointerException exception when you try to mock object in your tests. This article is a shortlist of the three most common reasons why this might be happening. Here is a working example of DocumentRepositoryTest class for reference

  1. MockMvc is the main entry point for server-side Spring MVC test support. Perform a request and return a type that allows chaining further actions, such as asserting expectations, on the result. @Mock creating a mock. This can also be achieved by using org.mockito.mock(..) method
  2. 有关更多详细信息,请参阅Spock Issue 758 ,简而言之, @Repository实例由代理中的spring包装以处理事务,这会破坏模拟交互设置。 您可以在testRepository字段上使用Spock 1.2(仅限SNAPSHOT)和新注释@UnwrapAopProxy 。 或者您可以使用此功能手动打开它。 public static <T> T getTargetObject(Object proxy) throws Exception { if.
  3. If you want to use Spock in your projects, you must separately add the spock-core and spock-spring modules. By default, the mode is MockMvc, which is based on Spring's MockMvc. It can also be changed to WebTestClient, JaxRsClient, or Explicit (for real HTTP calls)
  4. Tester un controller Spring avec Spock. Tous les projets Spring ne sont pas des projets Springboot. Et dans un contexte de production, ajouter les dépendances springboot pour juste disposer des apports dev-tools risque de faire bien plus que cela, comme par exemple : Forcer des montées de versions de dépendances communes
  5. Spock框架是基于Groovy语言的测试框架,Groovy与Java具备良好的互操作性,因此可以在Spring Boot项目中使用该框架写优雅、高效以及DSL化的测试用例。Spock通过@RunWith注解与JUnit框架协同使用,另外,Spock也可以和Mockito(Spring Boot应用的测试——Mockito)一起使用

また、Spock の特徴として、データ駆動テストが挙げられる。 データとテストのロジックを分けることができれば、同じテストロジックを繰り返し記述する必要もなく、テストを見通しやすくなる。 Spock はデータ駆動なテストを簡潔に記述できる springboot 2.x Spock +MockMvc单元测试-简单应用 技术标签: springboot测试类 java 项目中需要单元测试用例,之前写的时候是通过junit +MockMvc,能够实现功能,但是语法及代码写起来好麻烦,后来查到了spock,并且看了一些用例,感觉语法上看起来很清晰,而且会更简便.

Unit Testing Spring REST Controllers with MockMvc

Spock框架是基于Groovy语言的测试框架,Groovy与Java具备良好的互操作性,因此可以在Spring Boot项目中使用该框架写优雅、高效以及DSL化的测试用例。Spock通过*@RunWith*注解与JUnit框架协同使用,另外,Spock也可以和Mockito(Spring Boot应用的测试——Mockito)一起使用 Programming Foundations - Lotto Session #3 (Kotlin, Spring, & Spock) September 16, 2017 In this session, we construct the beginnings of a Lottery application that will utilize the Lotto model we introduced in Session #1 and later refactored (as Kotlin) in Session #2 /**A shortcut for {@code bindTo(asyncRestTemplate).build()}. * @param asyncRestTemplate the AsyncRestTemplate to set up for mock testing * @return the created mock server * @deprecated see deprecation notice on * {@link org.springframework.web.client.AsyncRestTemplate} itself */ @Deprecated public static MockRestServiceServer createServer(org.springframework. Spock框架是基于Groovy语言的测试框架,Groovy与Java具备良好的互操作性,因此可以在Spring Boot项目中使用该框架写优雅、高效以及DSL化的测试用例。Spock通过@RunWith注解与JUnit框架协同使用,另外,Spock也可以和Mockito(Spring Boot应用的测试——Mockito)协同使用

A Test-Driven Approach to Documenting RESTful APIs with Spring REST Docs - Gr8Conf US - Speaker Deck

MockMvc mockMvc // if any service to mock @SpringBean MyService myService. def Root returns 200 - OK(){when: response = mockMvc.perform(get(/)) then: response.andExpect(status().isOk())}} If you don't want to mock your services you can use directly @SpringBootTest which does the same job with only one annotatio 关于spring - Spock中的MockMvc无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27308451 普通にSpockの作法で記述していけば良いでしょう。. ではContextを使用したい場合どうするか?. これは少し追加が必要となります。. まずは build.gradle に以下を追加。. testCompile 'org.spockframework:spock-spring'. その上で、Specクラスは以下のようになります.

First, exclude the JUnit bundled copy of hamcrest-core, and include the useful hamcrest-library, it contains many useful methods to test the List data type 2018.01.15更新 后来在我司架构师的指点下,我改用了一种更优雅友好的方式来对FeignClient对象进行Mock。首先我们需要一个jar包 spring的这个jar.. The java.lang.Exception No runnable methods exception occurs when Junit detects no runnable test methods. In spring boot, the exception occurs where no test runnable methods are configured in junit test classes. The junit framework does not find a test method with the @Test annotation in the test class 本文首发于个人网站:在Spring Boot项目中使用Spock测试框架Spock框架是基于Groovy语言的测试框架,Groovy与Java具备良好的互操作性,因此可以在Spring Boot项目中使用该框架写优雅、高效以及DSL化的测试用例。Sp 在这个小节中我们会利用Spock、Mockito一起编写一些测试用例(包括对Controller的测试和对Repository的测试),感受下Spock的使用。 实战 根据 Building an Application with Spring Boot 这篇文章的描述, spring-boot-maven-plugin 这个插件同时也支持在Spring Boot框架中使用Groovy语言

Unit Testing of Spring MVC Controllers: Normal Controller

Spock 은 별도의 라이브러리를 추가해야하고 문서작성용으로는 조금 과하다고 느껴서 Spring Rest Docs 작성용으로 junit 을 채택하였습니다. Spock에 대해서 더 알고 싶으신 분은 블로그를 참고해주세요. 3-2. MockMvc(@WebMvcTest) VS Rest Assured(@SpringBootTest Mock有很多的实现框架,例如Mockito、EasyMock、Jmockit、PowerMock、Spock等等,SpringBoot默认的Mock框架是Mockito,和junit一样,只需要依赖spring-boot-starter-test就可以了。本文代码基于jdk8、junit5、Mockito3. 1.1、 Mockito中文文档. Mockito是mocking框架,它让你用简洁的API做测试 SpringBoot 单元测试与 Mockito 使用. 单元测试应遵循 → AIR 原则. SpringBoot 测试支持由两个模块提供: spring-boot-test 包含核心项目; spring-boot-test-autoconfigure 支持测试的自动配置; 通常我们只要引入 spring-boot-starter-test 依赖就行,它包含了一些常用的模块 Junit、Spring Test、AssertJ、Hamcrest、Mockito 等 Documentation generated from source code is very popular. Solutions such as Swagger are available for many different languages and frameworks. However, limitations of annotation based tools are becoming apparent. An overwhelming number of documentation annotations make for great docs but muddy the source code. Then, something changes and the docs are out of date again. That is where test. Version Repository Usages Date; 5.3.x. 5.3.9: Central: 89: Jul, 2021: 5.3.8: Central: 122: Jun, 202

关于Spring boot 之前没有用Spring的时候是用的MockMvc,做接口层的测试,原理上就是加载applicationContext.xml文件,然... 用户1154259 Spring Boot(十二)单元测试JUni The @SpringBootTest annotation tells Spring Boot to look for a main configuration class (one with @SpringBootApplication, for instance) and use that to start a Spring application context.You can run this test in your IDE or on the command line (by running ./mvnw test or ./gradlew test), and it should pass.To convince yourself that the context is creating your controller, you could add an. Spockテストケースは、JUnitの@Testアノテーションがないと機能しません AndroidのBasicAuthentication for webviewが機能しない UIColor拡張機能の便利な初期化が機能しな Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas.

A Test Driven Approach to Documenting RESTful APIs with Spring REST Docs - Speaker Deck

Running tests in Gradle is easy. Normally if one of the tests fails the build fails as well. But we don't see immediately in the command-line output why a test fails springboot test 前言. mac上idea快捷键,command+shift+T根据类生成快捷键。 对spring容器中的类做单元测试. 在src/main下建立UserService类,对其进行单于测试,生产其单元测试类(使用command+shift+T快捷键),生成的test类在src/test Spring Bootは単体テスト機能もついてます。 35. Testing Spring Bootでコントローラの単体テストをするには、まず単体テストのクラスをアノテーションでいろいろ飾ってやる必要があります。 package okazuki.validationEdu; import org.junit.Afte

Přesouvám text pro uživatelské interakce do externího souboru groovy config. Neměl jsem problémy s tím slurping, dokud nevznikla potřeba zacházet s textem, jako je tento 大数据知识库是一个专注于大数据架构与应用相关技术的分享平台,分享内容包括但不限于Hadoop、Spark、Kafka、Flink、Hive、HBase、ClickHouse、Kudu、Storm、Impala等大数据相关技术 Forex: My API will return List<Map<Object, Object>> the how can I get the List from mockMvc response so that I can assert on required part.. How to get the response object? Is below is the correct way? MvcResult andReturn = mockMvc.perform(get(url)).andDo(print()).andExpect(status().isOk()).andReturn();MockHttpServletResponse response = andReturn.getResponse() @Autowired private MockMvc mockMvc: MockMvc is the main entry point for server-side Spring MVC test support. It allows us to execute requests against the test context. @MockBean private StudentService studentService: MockBean is used to add mocks to a Spring ApplicationContext. A mock of studentService is created and auto-wired into the.

Although MockMvc is a useful tool, it is not so convenient when dealing with huge forms submission. To test a form containing a lot of fields, you have to map each one to an HTTP parameter like this: this.mockMvc.perform(MockMvcRequestBuilders.post(url) .param(field, fieldValue) .param(field2.nestedField, nestedFieldValue) MockMvc will mock sending the request integrating the full DispatcherServlet stack. If you want to mock the BindingResult argument, I suggest you test your @Controller class independently. // in @Test MyController controller = new MyController(/* maybe other arguments */) // generate your mocks and declare expectations controller.addEvent(/* mocks go here */); // verify your mock

Introduction to Spock: A Unit Testing Framework. Marshmallow: Easy Serialization in Python. Subscribe to Knoldus Blogs. Enter your email address to subscribe our blog and receive e-mail notifications of new posts by email. Join 1,941 other subscribers Email Addres PROBLEM Let's assume we want to test this controller:- Here's the test file:- When executing this test, we get the following error:- SOLUTION The reason this is happening is because the uri /help matches the returned view name help and we didn't set a ViewResolver when contructing the standalone MockMvc. Since MockMvcBuilders.standaloneSetup(...) doesn't load Sprin

Testing with Spring and Spock Baeldun

SMockMvc, obvykle nastavujete celý kontext webové aplikace a zesměšňujete požadavky a odpovědi HTTP.Takže, i když falešnýDispatcherServletje funkční a simuluje, jak bude fungovat váš zásobník MVC, nejsou vytvořena žádná skutečná síťová připojení.. SRestTemplate, abyste naslouchali odesílaným požadavkům HTTP, musíte nasadit skutečnou instanci serveru Spock. @spockframework. Creator: Spock. Language: Java. Spock is a framework for testing Java (and Groovy) applications. According to the site, this testing tool is compatible with most IDEs, build tools, and continuous integration servers. Obviously a play on sci-fi culture, it also has some fun theming thrown in to make things interesting

Generate a test class with code to construct the source class, initialize the dependencies and create test methods. Each test method contains code to initialize the arguments, invoke the source-method and compare the returned value to an expected value spring-spock-integration-testing:如何将Spock extension spring-mvc spock spock-framework Groovy 系统开源 java,spring,aop,框架,源代码 SpringBootJava Python SpringBoot+MockMvc测试Controller springboot MockMvc. The following examples show how to use org.springframework.test.web.servlet.MockMvc.These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example Body is empty when using MockMvc; When to use mock and when to use stub with spock? Why Won't These Jest Mocks Reset? Night watch change value of textContent or innerHTML; Downloading a file using WireMoc; Codeception custom SQL query to DROP a dynamic mys... File system operation validation at C standard lib.. 04 August Spring Restful web services xml example. Table of ContentsWeb service Tutorial Content:Spring application configuration:Create bean classCreate controllerRun the application This post is in continuation with web service tutorial (Part -10)

Spring Module - Spoc

MockMvc doesn't allow for calling external urls to perform the , so the first is ruled out. Mocking the session doesn't appear to give me a way to set cookies - I only see addCookie on the response object. Disabling the custom filter has resulted in nothing happening (maybe I'm doing this wrong) JUnit 4 Test - Basic Examples. Let's now begin with the creation of a basic JUnit 4 test. Under the package demo. tests, we have created a JUnit test class file and have included a method test_JUnit() that verifies if the str1 variable and string passed in the condition are both equal. The comparison of the expected condition has been performed by the assertEquals() method which is a JUnit. Spring @GetMapping example. The following application uses @GetMapping to map two request paths onto handler methods. In this example, we use annotations to set up a Spring web application. pom.xml src ├───main │ ├───java │ │ └───com │ │ └───zetcode │ │ ├───config │ │ │ MyWebInitializer.java │ │ │ WebConfig.java. Spockを使用したコントローラテストでのMock Springサービス ; 6. mockまたはgradleを使用しないSpock ; 7. MockMVCを使用してコントローラの@RequestBodyパラメータを渡す方法 ; 8. MockMVCを介したフォームの投稿 ; 9 While watching Andy Wilkinson's great talk, Testing Spring Boot Applications on YouTube, he brought my attention to a hidden gem for testing the Spring RestTemplate. In the past, I always wondered how to write proper tests for client classes using the RestTemplate to fetch data from external services. In his presentation, he mentioned the @RestClientTest annotation that provides everything you.

MockMVC class is part of Spring MVC test framework which helps in testing the controllers explicitly starting a Servlet container. In this MockMVC tutorial, we will use it along with Spring boot's WebMvcTest class to execute Junit testcases which tests REST controller methods written for Spring boot 2 hateoas example.. Click to read more on it. Moreover, what is Mockmvcbuilders Spock通过@RunWith注解与JUnit框架协同使用,另外,Spock也可以和Mockito(SpringBoot应用的测试——Mockito)协同使用。在这个小节中我们会利用Spock、Mockito一起编写一些测试用例(包括对Controller的测试和对Repository的测试),感受下Spock的使用。HowDo根据B Sasa Fajkovic (Berlin, Germany) - Software Engineer/Web developer available for freelance work By default spock.lang.Specification if using Spock tests. ruleClassForTests - specifies Rule which should be added to generated test classes. ignoredFiles - Ant matcher allowing defining stub files for which processing should be skipped. By default empty array [] contractsDslDir - directory containing contracts written using the GroovyDSL

Speed Up Spock Spring Tests Object Partner

This video covers how to write Unit tests and Integrations in Spring Boot Application which uses Spring Data JPA. Related Playlist=====Spring. <p>One of the nice things about working for Pivotal is that they have a great agile development division called Pivotal Labs. The teams within Labs are big proponents of Lean and XP software methodologies such as pair programming and test-driven development. Their love of testing has had a particular impact on Spring Boot 1.4 as we've started to get great feedback on things that could be. After we have finished this lesson, we: Can add custom source and resource directories into our Maven build. Know how we can run our integration tests with Maven. Understand how we can skip either unit or integration tests by using Maven profiles. The text version of this lesson is given in the following: Th JUnit 5 is the next generation of JUnit. The goal is to create an up-to-date foundation for developer-side testing on the JVM. This includes focusing on Java 8 and above, as well as enabling many different styles of testing. JUnit 5 is the result of JUnit Lambda and its crowdfunding campaign on Indiegogo

看了此文的人还看了 Android SDK 及native方法 单元测试 从零开始写单元测试 【C#】【xUnit】【Moq】.NET单元测试Mock框架Moq初探! SSH框架下单元测试的实现 测试金字塔和持续自动化测试 python中的测试框架 SpringBoot Spock单元测试框架实战指南一Spock是什么? 它和JUnit有什么区别 Introduction You can download selenium-java-3.141.59.jar in this page. License The Apache Software License, Version 2.0 Type List selenium-java-3.141.59.jar file has. Spring Boot Tutorials. Hands-on examples. - Basics of Spring Boot. Covers Spring Boot Starter Projects, Spring Initializr, Creating REST Services, Unit and Integration tests, Profiles, Spring Boot Data JPA, Actuator and Securit

CSDN问答为您找到关于springmvc junit中MockMVC测试controller 报空指针错误相关问题答案,如果想了解更多关于关于springmvc junit中MockMVC测试controller 报空指针错误 spring 技术问题等相关问答,请访问CSDN问答 MockMVC class is part of Spring MVC test framework which helps in testing the controllers explicitly starting a Servlet container. In this MockMVC tutorial, we will use it along with Spring boot's WebMvcTest class to execute Junit testcases which tests REST controller methods written for Spring boot 2 hateoas example.. Click to read in-depth answer. Keeping this in consideration, what is the. はじめにこんにちは。NIKKOエンジニアのS.TKです。皆さん、テストはしていますか?最近の開発手法であれば、ほぼ確実にテストが考慮されているので嫌でもしていますよね。ただ、テストって実は結構難しかっ.. Petri Kainulainen is passionate about software development and continuous improvement. He is specialized in software development with the Spring Framework and is the author of Spring Data book 3.6 Spring MVC测试框架Spring MVC测试框架提供了一流的支持,可使用可与JUnit、TestNG或任何其他测试框架一起使用的流畅API测试Spring MVC代码。它基于spring-test模块的Servlet API模拟对象构建,因此不使用运行中的Servlet容器。它使用DispatcherServlet提供完整的Spring MVC运行时行为,并支持通过TestCon