You are previewing Learning Spring Boot.
O'Reilly logo
Learning Spring Boot

Book Description

Learn how to use Spring Boot to build apps faster than ever before

In Detail

This practical, accessible guide helps you get up and running fast with Spring Boot. This book starts by crafting a Spring MVC application using the Spring stack on top of Apache Tomcat, with little configuration on from your end. You will also learn how to write both JUnit and Spock test cases. Then, you'll pull back the curtain and see how Spring Boot works by using Spring Messaging (JMS and AMQP) as well as creating custom metrics, custom information, and custom CLI commands aimed at production environments. In the last two chapters, you'll see how Spring Boot supports everyday situations we all deal with. You will learn how to create multiple configurations inside your app that can interact with different data stores.

By the end of the book, you'll have a good understanding of how Spring Boot works, how it manages low-level infrastructure, and how to start out production-grade apps with built-in support tools as well as custom ones.

What You Will Learn

  • Use Spring Boot's CLI tool to build rapid Groovy-based apps without even touching a build tool
  • Craft a Spring JMS app with ActiveMQ
  • Work with multiple database configurations using Spring Data JPA in development and production as well as Spring Data MongoDB
  • Find out exactly what beans Spring Boot is creating for you, and why it decided to do so
  • Secure your app at the URL and method levels
  • Use Spring Data REST to export your Spring Data repositories to support independent clients
  • Configure the embedded Tomcat servlet engine to use SSL and see how it automatically uses HSTS
  • Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

    Table of Contents

    1. Learning Spring Boot
      1. Table of Contents
      2. Learning Spring Boot
      3. Credits
      4. Foreword
      5. About the Author
      6. About the Reviewers
      7. www.PacktPub.com
        1. Support files, eBooks, discount offers, and more
          1. Why subscribe?
          2. Free access for Packt account holders
      8. 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
        7. Piracy
        8. Questions
      9. 1. Quick Start with Groovy
        1. Getting started
        2. Installing Spring Boot's CLI
        3. Testing with Spring Boot's CLI
        4. Bundling and deploying a Spring Boot application
        5. Adding support for templates
        6. Modernizing our app with JavaScript
          1. Using Bower instead of WebJars
          2. What about an app that is all frontend with no backend?
        7. Adding production-ready support features
          1. Pinging our app for general health
          2. Gathering metrics
          3. Detailed management with CRaSH
        8. Summary
      10. 2. Quick Start with Java
        1. Creating an empty project with start.spring.io
          1. Spring Boot starters
        2. Running a Spring Boot application
        3. Adding Spring Social GitHub
        4. Digging into GitHub issues
          1. Creating a GitHub access token
        5. Delving into Spring Boot's property support
        6. Adding server-side mobile support with Spring Mobile
        7. Creating a mobile frontend with jQuery Mobile
        8. Bundling up the application as a runnable JAR
        9. Deploying to Cloud Foundry
        10. Adding production-ready support
        11. Summary
      11. 3. Debugging and Managing Your App
        1. Creating a JMS-based publisher/subscriber app
        2. Using Spring Boot's auto-configuration report
          1. Auto-configuring ActiveMQ
          2. Making a change and debugging the results
        3. Overriding Boot with alternate beans or properties
        4. Writing a custom health check to ping ActiveMQ
        5. Adding customized app data to /info
        6. Creating custom metrics to track the message traffic
        7. Tweaking management ports, address, and paths
        8. Restricting access only to JMX
        9. Connecting to the app via JConsole and jmxterm
        10. Creating custom CRaSH commands
        11. Summary
      12. 4. Data Access with Spring Boot
        1. Creating an app using H2's in-memory database
        2. Defining entities and repositories
        3. Loading data using a SQL script
        4. Loading data programmatically
        5. Adding a production profile for a MySQL database
        6. Adding Spring Data REST and using it to manage teammates
        7. Reconfiguring our app to use Spring Data MongoDB
        8. Running our MongoDB-based app
        9. Summary
      13. 5. Securing Your App with Spring Boot
        1. Getting started
        2. Defining our domain
        3. Loading the test data
        4. Creating a server-side controller
        5. Crafting our HTML templates
        6. Running our unsecured application
        7. Securing our app
        8. Navigating with basic authentication
        9. Enhancing the security model of our app
        10. Configuring user data to persist
        11. Configuring embedded Tomcat to use SSL
        12. Spring Security's default web-level protections
        13. Navigating our fully secured app
        14. Summary
      14. Index