Preface

This book is designed for both novices and experienced Spring developers. It will teach you how to build Java applications without wasting time on infrastructure and other tedious details. Instead, it will help you focus on building web apps on top of real databases, locked down with modern security practices.

On top of that, you’ll discover multiple ways to carry an app to production. If that’s not enough, it even includes secret ways (okay, not really secret) at the end to squeeze more out of your existing servers (or cloud) by picking up and running with reactive programming.

Who this book is for

This book is designed for both novices and experienced Spring developers who want to get their hands on Spring Boot 3.0. You should have a rudimentary understanding of Java, preferably Java 8 or higher. Being familiar with lambda functions, method references, record types, and the new-and-improved collections API found in Java 17 is a bonus, but not required.

Having used previous versions of Spring Boot (1.x, 2.x) is not required but would be handy.

What this book covers

Chapter 1, Core Features of Spring Boot, is where you discover the charm of Spring Boot with its fundamental features to work with you as you build your app.

Chapter 2, Creating a Web Application with Spring Boot, teaches you how to craft the web layer for a Java app with ease, with both server-side and client-side options.

Chapter 3, Querying for Data with Spring Boot, shows you how to get the most out of your database with Spring Data.

Chapter 4, Securing an Application with Spring Boot, shows you how to use Spring Security’s cutting-edge features to lock down your app from bad guys, inside and out.

Chapter 5, Testing with Spring Boot, teaches you how to build confidence in your systems through testing with mocks and embedded databases, and even using Testcontainers combined with real databases.

Chapter 6, Configuring an Application with Spring Boot, shows you ways to tune and adapt your app once it’s built.

Chapter 7, Releasing an Application with Spring Boot, helps you discover multiple ways to take your app to production and put it in the hands of your users.

Chapter 8, Going Native with Spring Boot, shows you how to speed up your app by leaps and bounds using native images that start in subsecond time and don’t hog all your resources.

Chapter 9, Writing Reactive Web Controllers, teaches you how easy it is to write reactive web controllers and how they can be your key to a more efficient app.

Chapter 10, Working with Data Reactively, helps you discover how to query for data reactively using R2DBC and see how efficient your app can be.

To get the most out of this book

Spring Boot 3.0 is built on Java 17. By using sdkman (https://sdkman.io), you can easily install the version of Java needed. In Chapter 8, Going Native with Spring Boot, we’ll include instructions on how to use sdkman to install a specific flavor of Java 17 that supports building native images for GraalVM. While it’s possible to write code using a barebones text editor, any modern IDE (see the following list) will greatly enhance the coding experience. Check out the one that works best for you.

Software/hardware covered in the book

Operating system requirements

sdkman (for Java 17) (https://sdkman.io)

Windows, macOS, or Linux

Any modern IDE will help with writing code:

Windows, macOS, or Linux

VS Code and Spring Tool Suite are free. IntelliJ IDEA has a Community Edition and an Ultimate Edition. The Community Edition is free, but some of the Spring-specific features require purchasing the Ultimate Edition. There is a 30-day trial to give it a spin.

If you are using the digital version of this book, we advise you to type the code yourself or access the code from the book’s GitHub repository (a link is available in the next section). Doing so will help you avoid any potential errors related to the copying and pasting of code.

This book, however, isn’t the end of your journey into building Spring Boot apps. Check out my YouTube channel, Spring Boot Learning (http://bit.ly/3uSPLCz), where I publish videos all the time on Spring Boot and software engineering. There are also additional resources at https://springbootlearning.com to help you write better apps!

Download the example code files

You can download the example code files for this book from GitHub at https://github.com/PacktPublishing/Learning-Spring-Boot-3.0. If there’s an update to the code, it will be updated in the GitHub repository.

We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Download the color images

We also provide a PDF file that has color images of the screenshots and diagrams used in this book. You can download it here: https://packt.link/FvE6S.

Conventions used

There are a number of text conventions used throughout this book.

Code in text: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: “This can be done by first adding an application.properties file to our src/main/resources folder.”

A block of code is set as follows:

@Controller
public class HomeController {
  private final VideoService videoService;
  public HomeController(VideoService videoService) {
    this.videoService = videoService;
  }
  @GetMapping("/")
  public String index(Model model) {
    model.addAttribute("videos", videoService.getVideos());
    return "index";
  }
}

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

@Bean
SecurityFilterChain configureSecurity(HttpSecurity http) {
  http.authorizeHttpRequests()
    .requestMatchers("/login").permitAll()
    .requestMatchers("/", "/search").authenticated()
    .anyRequest().denyAll()
    .and()
    .formLogin()
    .and()
    .httpBasic();
  return http.build();
}

Any command-line input or output is written as follows:

$ cd ch7

$ ./mvnw clean spring-boot:build-image

Bold: Indicates a new term, an important word, or words that you see onscreen. For instance, words in menus or dialog boxes appear in bold. Here is an example: “To do that, go to the Dependencies section.”

Tips or important notes

Appear like this.

Get in touch

Feedback from our readers is always welcome.

General feedback: If you have questions about any aspect of this book, email us at [email protected] and mention the book title in the subject of your message.

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packtpub.com/support/errata and fill in the form.

Piracy: If you come across any illegal copies of our works in any form on the internet, we would be grateful if you would provide us with the location address or website name. Please contact us at [email protected] with a link to the material.

If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit authors.packtpub.com.

Share Your Thoughts

Once you’ve read Learning Spring Boot 3.0, we’d love to hear your thoughts! Please click here to go straight to the Amazon review page for this book and share your feedback.

Your review is important to us and the tech community and will help us make sure we’re delivering excellent quality content.

Download a free PDF copy of this book

Thanks for purchasing this book!

Do you like to read on the go but are unable to carry your print books everywhere?

Is your eBook purchase not compatible with the device of your choice?

Don’t worry, now with every Packt book you get a DRM-free PDF version of that book at no cost.

Read anywhere, any place, on any device. Search, copy, and paste code from your favorite technical books directly into your application.

The perks don’t stop there, you can get exclusive access to discounts, newsletters, and great free content in your inbox daily

Follow these simple steps to get the benefits:

  1. Scan the QR code or visit the link below

https://packt.link/free-ebook/9781803233307

  1. Submit your proof of purchase
  2. That’s it! We’ll send your free PDF and other benefits to your email directly
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset