Mastering Spring Application Development

Book description

Gain expertise in developing and caching your applications running on the JVM with Spring

  • Build full-featured web applications, such as Spring MVC applications, efficiently that will get you up and running with Spring web development

  • Reuse working code snippets handy for integration scenarios such as Twitter, e-mail, FTP, databases, and many others

  • An advanced guide which includes Java programs to integrate Spring with Thymeleaf

  • In Detail

    Spring is an open source Java application development framework to build and deploy systems and applications running on the JVM. It is the industry standard for Web development and the most popular framework among Java developers. It makes it easy to build modular and testable Web applications by using the Model-View-Controller paradigm and dependency injection.

    Mastering Spring Application Development will take you on a journey from developing simple applications with Spring Data and MongoDB to caching your application with Spring Cache. You will discover how Thymeleaf will help you develop applications faster and how to configure it, and how to master dependency. Finally, you will get to grips with Web services by creating RESTful services and SOAP services using Spring Web Service framework, helping you to write Web service client code. You will learn how to set up a spring cache and tie your caching code with business logic.

    Table of contents

    1. Mastering Spring Application Development
      1. Table of Contents
      2. Mastering Spring Application Development
      3. Credits
      4. About the Author
      5. About the Reviewers
      6. www.PacktPub.com
        1. Support files, eBooks, discount offers, and more
          1. Why subscribe?
          2. Free access for Packt account holders
      7. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Downloading the example code
          2. Errata
          3. Piracy
          4. Questions
      8. 1. Spring Mongo Integration
        1. Installing MongoDB and creating a database
        2. Setting up a batch file for MongoDB
          1. Order use case with Spring and MongoDB
        3. Mapping a Mongo document to Spring Bean
        4. Setting up a Spring-MongoDB project
          1. Application design
            1. Application implementation of Spring with MongoDB
        5. Order management use case
          1. Creating and inserting Order
          2. Controller to handle requests
            1. Adding the @Modelattribute annotation at the Method level
          3. CRUD operations of the OrderController class
            1. JSP files
        6. Summary
      9. 2. Messaging with Spring JMS
        1. Types of messaging
          1. Message consumers
          2. Message structure
          3. Message-driven POJOs and listeners
          4. Open source messaging tools
        2. Apache ActiveMQ
          1. Setting up ApacheMQ for point-to-point messaging
          2. Use case for ApacheMq with Spring JmsTemplate
          3. Spring dependency
        3. Implementing the Order Management Messaging System with SpringJMS and ActiveMQ
          1. Configuring dispatcherservlet.xml to use JMS
        4. Working with multiple queues in ApacheMQ
          1. Configuring JMS transactions
          2. Configuring multiple JMS listeners and adapters
        5. JMS transactions
        6. Summary
      10. 3. Mailing with Spring Mail
        1. Spring mail message handling process
        2. Interfaces and classes used for sending mails with Spring
        3. Sending mail using the @Configuration annotation
        4. Sending mail using MailSender and SimpleMailMessage with the XML configuration
          1. Sending mails to multiple recipients
        5. Sending MIME messages
        6. Sending attachments with mails
        7. Sending preconfigured mails
        8. Using Spring templates with Velocity to send HTML mails
        9. Sending Spring mails over a different thread
        10. Sending Spring mails with AOP
        11. Summary
      11. 4. Jobs with Spring Batch
        1. Introduction to Spring Batch
          1. Use cases for using Spring Batch
          2. Goals of batch processing
        2. Architecture of a batch job
          1. Using an enterprise batch
        3. Dependency for Spring Batch
          1. Key components of Spring Batch
        4. Developing a sample batch application
          1. Creating a sample batch application using the Tasklet interface
          2. Using Spring Batch to read a CSV file
          3. Spring Batch with a Spring scheduler
          4. Configuring Spring Batch with Quartz scheduler
          5. Using Spring Batch to read a file and update a MongoDB database
          6. Using Spring Batch with threads to partition jobs
        5. Intercepting a Spring Batch job with listeners
        6. Unit testing Spring Batch applications
        7. Summary
      12. 5. Spring Integration with FTP
        1. Maven dependency
        2. Spring's XSD for FTP
          1. Configuring an outbound channel adapter for FTP
          2. Configuring an inbound channel adapter for FTP
        3. FTPSessionFactory and FTPSSessionFactory
        4. Spring FTP using an outbound channel example
          1. Configuring Spring FTP to read files in subfolders using the gateway
          2. Configuring Spring FTP in Java
        5. Sending files over FTP using the Spring integration
          1. FTP application using the Spring integration and Spring batch
        6. Summary
      13. 6. Spring Integration with HTTP
        1. HTTP methods and status codes
          1. HTTP headers
          2. HTTP time-out
          3. HTTP proxy settings in Java
        2. Proxy configuration support in Spring
          1. Spring Integration support for HTTP
          2. Spring Integration support for multipart HTTP requests
          3. Spring Integration support for HTTP responses
        3. Configuring the outbound HTTP messages
          1. Configuring cookies with OutboundGateway
        4. Configuring InboundGateway with both no response and with the response
        5. RequestMapping support for an inbound channel adapter or a gateway
          1. Configuring the RequestMapping using the HTTP inbound endpoint
          2. Configuring the inbound channel adapter to read request information from the URL
        6. Configuring the outbound gateway for HTTP responses
          1. Configuring the outbound adapter for different response types
        7. Mapping URI variables as subelement with an HTTP outbound gateway and an outbound channel adapter
          1. Handling time-out with the HTTP outbound gateway and the HTTP inbound gateway
        8. Spring support for header customizations
        9. Sending multipart HTTP requests using Spring's RestTemplate
        10. Summary
      14. 7. Spring with Hadoop
        1. Apache Hadoop modules
          1. Spring namespace for Hadoop
          2. Hadoop Distributed Files System
          3. HBase
          4. Map and Reduce
          5. Creating a configuration object in Spring for Map and Reduce
            1. Map and Reduce jobs with Spring
              1. Dependencies for Maven project
          6. Map and Reduce jobs using Hadoop streaming and Spring DataApache Hadoop
        2. Summary
      15. 8. Spring with OSGI
        1. OSGI containers
          1. OSGI usage
        2. Spring integration with OSGI
        3. Spring Dynamic Modules and OSGI
          1. Simple applications with OSGI
        4. Integrating Spring Dynamic Modules with OSGI
        5. Summary
      16. 9. Bootstrap your Application with Spring Boot
        1. Setting up Spring Boot
        2. Spring Gradle MVC application
          1. Hot swapping with Spring Boot
          2. Integrating Spring Boot with Spring Security
        3. Cloud Foundry support for Eclipse Spring Boot
        4. RestfulWebService using Spring Boot
        5. Summary
      17. 10. Spring Cache
        1. Spring annotations for caching
          1. @Cacheable usage
          2. The @CacheEvict usage
        2. Spring caching repository
          1. The Ehcache popular library
        3. Spring CacheManager
        4. Maven dependency for Spring with caching
          1. Declarative configuration of ehcache
        5. Spring MVC with caching
        6. Implementing your own caching algorithm
        7. Summary
      18. 11. Spring with Thymeleaf Integration
        1. Thymeleaf attributes
        2. Spring Thymeleaf dependency
          1. Spring MVC and Thymeleaf
          2. MVC with Spring Thymeleaf
        3. Spring Boot with Thymeleaf and Maven
          1. Reloading Thymeleaf templates
          2. Spring security with Thymeleaf
        4. Summary
      19. 12. Spring with Web Service Integration
        1. Spring with JAX-WS
        2. Spring Web Services with JAXB marshalling for request
        3. Writing a client application for Spring Web Services using JAXB unmarshalling for request
        4. Summary
      20. Index

    Product information

    • Title: Mastering Spring Application Development
    • Author(s): Anjana Mankale
    • Release date: May 2015
    • Publisher(s): Packt Publishing
    • ISBN: 9781783987320