Spring MVC Cookbook: 40+ Recipes for Cloud-Ready Java Web Applic...

5星 · 超过95%的资源 需积分: 9 249 下载量 197 浏览量 更新于2024-07-20 1 收藏 7.46MB PDF 举报
"Spring MVC Cookbook2016.2.pdf - 英文版,涵盖了使用Spring MVC创建云就绪Java Web应用程序的40多个食谱,作者Alex Bretet" 《Spring MVC Cookbook》是一本专为Java Web开发人员设计的实用指南,主要针对Spring MVC框架。这本书由Alex Bretet撰写,于2016年由Packt Publishing出版。本书的核心目标是提供超过40个“食谱”,即具体的方法和解决方案,帮助开发者构建能够适应云计算环境的Java Web应用程序。 Spring MVC是Spring框架的一个重要组成部分,它是一个用于构建Web应用程序的模型-视图-控制器(MVC)架构。该框架简化了开发过程,提供了强大的功能,如依赖注入、数据绑定、异常处理和视图解析等。在《Spring MVC Cookbook》中,读者可以期待学习到以下关键知识点: 1. **Spring MVC基础**:了解如何设置Spring MVC项目,包括配置MVC Dispatcher Servlet、定义Controller、处理HTTP请求和响应。 2. **模型管理**:学习如何使用ModelAndView对象传递数据到视图,以及如何利用Spring的数据绑定功能。 3. **视图解析**:理解不同的视图技术,如JSP、Thymeleaf或FreeMarker,并学习如何配置视图解析器。 4. **控制器的高级使用**:探索预处理器和后处理器的概念,以及如何使用拦截器来实现更复杂的请求处理逻辑。 5. **数据访问**:掌握如何与数据库交互,使用JdbcTemplate或Hibernate等ORM工具,以及处理表单提交和验证。 6. **RESTful服务**:创建符合REST原则的Web服务,包括HTTP动词(GET、POST、PUT、DELETE)、资源表示和状态码。 7. **错误和异常处理**:学习如何优雅地处理程序中的错误和异常,提供定制化的错误页面。 8. **国际化和本地化**:了解如何实现多语言支持,根据用户偏好展示不同语言的内容。 9. **测试Spring MVC应用**:学习单元测试和集成测试策略,包括MockMVC和Spring Test框架的使用。 10. **性能和安全性**:优化应用程序性能,了解如何集成Spring Security进行身份验证和授权。 11. **云部署**:探讨如何将Spring MVC应用部署到云平台,如Amazon AWS或Google Cloud Platform。 这本书适合对Spring有一定了解,希望深入掌握Spring MVC特性和实践的开发者。通过阅读和实践书中的食谱,读者将能够有效地构建出健壮、可扩展和云就绪的Java Web应用程序。
2016-03-14 上传
Over 40 recipes for creating cloud-ready Java web applications with Spring MVC About This Book Configure Spring MVC to build logic-less controllers that transparently support the most advanced web techniques Build an amazing social and financial application that applies microservices patterns on deployment, self-testability, interoperability, cloud architectures, and scalability Fast-paced, practical guide to learn how to set up Spring MVC to produce REST resources and templates as required by the latest front-end best practices Who This Book Is For If you are an experienced Java developer, with prior experience in web technologies, and want to step up in your career and stay up-to-date or learn more about Spring Web scalability, this book is for you. What You Will Learn Structure your project with Maven and create self-tested, domain-specific deployable web archives Generate templates for a responsive and powerful frontend with AngularJS and Bootstrap Build a high performance stateless RESTful and hypermedia application to support your multiple customer experiences Authenticate over REST with a BASIC authentication scheme and OAuth2; handle roles and permissions Document and publish your REST API using Swagger and Swagger UI Scale your Spring web application Communicate through WebSocket and STOMP messages Provide support to your application and efficiently maintain its business features with a relevant test stack In Detail Spring MVC is a lightweight application framework that comes with a great configuration by default. Being part of the Spring Framework, it naturally extended and supported it with an amazing set of recognizable annotations. External libraries can be plugged in and plugged out. It also possesses a request flow. Complete support of REST web services makes the Spring architecture an extremely consistent choice to support your front-end needs and Internet transformations. From the design of your Maven modules, you will achieve an Enterprise-standard for a stateless REST application based on Spring and Spring MVC with this book. This guide is unique in its style as it features a massive overview of practical development techniques brought together from the Spring ecosystem, the new JEE standards, the JavaScript revolution and Internet of Things. You will begin with the very first steps of Spring MVC's product design. Focused on deployment, viability, and maintainability, you will learn the use of Eclipse, Maven, and Git. You will walk through the separation of concerns driven by the microservices principles. Using Bootstrap and AngularJS, you will develop a responsive front-end, capable of interacting autonomously with a REST API. Later in the book, you will setup the Java Persistence API (JPA) within Spring; learn how to configure your Entities to reflect your domain needs, and discover Spring Data repositories. You will analyze how Spring MVC responds to complex HTTP requests. You will implement Hypermedia and HATEOAS to guide your customer's stateless conversation with the product and see how a messaging-service based on WebSocket can be configured. Finally you will learn how to set up and organize different levels of automated-tests, including logging and monitoring. Style and approach A comprehensive, recipe-based guide to creating stunning Java apps with Spring MVC as a result of learning and implementing pro-level practices, techniques, and solutions. Table of Contents Chapter 1: Setup Routine for an Enterprise Spring Application Chapter 2: Designing a Microservice Architecture with Spring MVC Chapter 3: Working with Java Persistence and Entities Chapter 4: Building a REST API for a Stateless Architecture Chapter 5: Authenticating with Spring MVC Chapter 6: Implementing HATEOAS Chapter 7: Developing CRUD Operations and Validations Chapter 8: Communicating Through WebSockets and STOMP Chapter 9: Testing and Troubleshooting