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

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.

主站蜘蛛池模板: 城口县| 富平县| 金秀| 临潭县| 攀枝花市| 阜康市| 萍乡市| 延边| 武冈市| 扎鲁特旗| 大宁县| 濮阳县| 策勒县| 仪征市| 齐河县| 广昌县| 海南省| 绥江县| 叶城县| 喜德县| 华阴市| 宣汉县| 竹山县| 仁寿县| 阳新县| 小金县| 乌兰浩特市| 泗水县| 潞城市| 仁寿县| 峡江县| 治多县| 德清县| 民乐县| 辰溪县| 万年县| 会东县| 克拉玛依市| 红安县| 万山特区| 银川市|