官术网_书友最值得收藏!

What this book covers

Chapter 1, Getting Familiar with the Spring Framework, covers the basics of Spring, Spring projects, and especially the Spring Framework. It explores the Spring container, the life cycle of beans, dependency injection, AOP, Spring MVC, and Spring transaction management.

Chapter 2, Working with JUnit and Mockito, covers both basic and advanced JUnit usages. It covers annotation-based JUnit testing, assertion, the @RunWith annotation, exception handling, and the Eclipse setup to run JUnit tests, matchers, and assertThat, as well as the custom lessThanOrEqual() matcher. The Working with Mockito section explores the Mockito framework and provides technical examples to demonstrate the capability of Mockito.

Chapter 3, Working with Spring Tests, illustrates every aspect of unit testing your Spring applications. It starts with TestContext and explores the JUnit 4 enabled SpringJUnit4ClassRunner. Then, it explores Spring profiles that can be used to work with the different sets of configuration files as well as the Spring environment and how to mock the environment with MockEnvironment and MockPropertySource. We use the ReflectionTestUtils method to access the private fields of the Spring beans. The chapter provides usage examples of Spring annotations for testing, unit tests the MVC application with MockHttpServletRequest, MockHttpSession, and ModelAndViewAssert, and mocks the servlet container with MockMvc to handle actual requests and responses, as they will be at runtime. You will also perform real Spring integration and transaction management with annotations such as @Transactional, @TransactionConfiguration, and @Rollback.

Chapter 4, Resolving Out-of-container Dependencies with Mockito, deals with unit testing the service layer in isolation from the data access layer with Mockito, unit testing the Spring data access layer with Mockito, and unit testing the Spring presentation layer (MVC) with Mockito.

Chapter 5, Time Travelling with Spring, starts by covering the features of the new major Spring release 4.0, such as Java 8 support and so on. Then, we pick the four Spring 4 topics and explore them one by one. The Working with asynchronous tasks section showcases the execution of long running methods asynchronously and provides examples to handle asynchronous processing. The Exploring @RestController section eases RESTful web service development with the advent of the @RestController annotation. The Learning AsyncRestTemplate section explains the RESTful client code to invoke RESTful web services asynchronously. Caching is inevitable for high performant, scalable web applications. This section explains EhCache and Spring integration to achieve a high availability caching solution.

主站蜘蛛池模板: 丰顺县| 茶陵县| 黄冈市| 民县| 穆棱市| 裕民县| 台北市| 靖边县| 公安县| 太保市| 青岛市| 兴海县| 金华市| 洪湖市| 新竹县| 左云县| 成武县| 武穴市| 乐昌市| 纳雍县| 怀远县| 金昌市| 兴城市| 辽阳县| 邵武市| 虞城县| 鄂州市| 上犹县| 抚州市| 正定县| 如东县| 道孚县| 十堰市| 昆山市| 芮城县| 错那县| 永登县| 三门县| 石河子市| 青州市| 灵武市|