Spring Boot and Angular: Hands-on full stack web development with Java, Spring, and Angular
- Length: 392 pages
- Edition: 1
- Language: English
- Publisher: Packt Publishing
- Publication Date: 2023-01-10
- ISBN-10: 180324321X
- ISBN-13: 9781803243214
- Sales Rank: #1007529 (See Top 100 Books)
Design, build, and deploy performant and maintainable web applications using Spring, Spring Boot, and Angular
Key Features
- Explore key concepts and best practices in developing full stack applications for real-world use cases
- Boost your career as a full stack Java developer using advanced Spring tips and techniques
- Dive into the practical concepts of frontend development with Angular without the need for theory
Book Description
Angular is a battle-tested and batteries-included JavaScript framework that is trusted by enterprises across the globe. Together with Spring Boot, it enables you to set up a resilient full stack for your web development project. This guide will help you harness the features of both these technologies and build complete Java web applications with impressive frontend.
You will begin your journey of building Java full stack apps by learning how to set up the CI/CD pipeline. Then, you’ll find out how to build the backend for your app, guided by best practices to ensure security, performance, and testability. As you progress through the chapters, you’ll discover how to build the frontend for your app, architected for enterprise. The concluding chapters will teach you all about deploying your application using GitHub Actions.
By the end of this web development book, you’ll have learned how to build a full stack web app using the most popular NPM packages for Angular and Java. You’ll not just be able to build the app, but also package and deploy it through using continuous integration and continuous deployment practices.
What you will learn
- Find out how to architect Angular for enterprise-level app development
- Create a Spring Boot project using Spring Initializr
- Build RESTful APIs for Java web applications
- Understand how caching with Redis can improve your app’s performance
- Discover how CORS with Spring Boot can improve your app’s security
- Write tests to maintain a healthy Java Spring Boot application
- Implement testing and modern deployments in full stack app development
Who This Book Is For
The book is for Java web developers with beginner-level experience in Spring Boot who want to develop complete web applications by leveraging the power of the JavaScript framework. An understanding of HTML, CSS, and Spring Boot is assumed as the book is not intended to help you get started with Angular.
Spring Boot and Angular Contributors About the authors About the reviewer Preface Who this book is for What this book covers To get the most out of this book Download the example code files Download the color images Conventions used Get in touch Share Your Thoughts Download a free PDF copy of this book Part 1: Overview of Spring Boot and Angular Development Chapter 1: Spring Boot and Angular – The Big Picture Technical requirements Introducing Spring Boot The advantages of using Spring Boot Differences between Spring and Spring Boot Dependency examples for Spring and Spring Boot What’s new in Java 17? Sealed classes The foreign function and memory API Pattern matching with switch statements The Applet API The experimental AOT and JIT compilers Introducing Angular History of Angular The advantages of using Angular Summary Chapter 2: Setting Up the Development Environment Technical requirements Installing VS Code and IntelliJ IDEA VS Code IntelliJ IDEA Installing Java 17 Windows installation macOS installation Linux installation Installing SDKMAN SDKMAN features Installation on macOS and Linux Installation on Windows Setting up IntelliJ IDEA with Java 17 Using Java 17 on new projects Using Java 17 on existing projects Installing REST Client VS Code or JetBrains and Angular DevTools Installing REST Client in VS Code Installing Angular DevTools Installing Git version control Summary Part 2: Backend Development Chapter 3: Moving into Spring Boot Technical requirements Understanding Spring Boot Spring Boot architecture Spring Boot flow architecture Understanding REST Using Spring Initializr Web-based interface Via IntelliJ IDEA Dependency injection Inversion of control The basics of dependency injection Annotation and beans Types of annotations Understanding beans Summary Chapter 4: Setting Up the Database and Spring Data JPA Technical requirements Connecting to a database using a PSQL container PostgreSQL Installing PostgreSQL Spring Data JPA The advantages of Spring Data JPA Repositories provided by Spring Data JPA Spring Data JPA on Spring Boot Adding Spring Data JPA and PostgreSQL dependencies Adding with Spring Initializr Adding an existing project Connecting to a database Configuring the database properties Connecting using Spring JDBC Connecting using Spring Data JPA Summary Chapter 5: Building APIs with Spring Technical requirements Starting the server Adding models Creating models with DTOs and Lombok Writing services JPA repository Adding controllers Adding Redis for caching Installing the Redis server Configuring Redis on Spring Boot Summary Chapter 6: Documenting APIs with the OpenAPI Specification Technical requirements Setting up springdoc-openapi The properties of springdoc-openapi The plugins of springdoc-openapi Configuring springdoc-openapi Setting up Swagger UI Installing and using Swagger UI Displaying pagination information in Swagger UI Summary Chapter 7: Adding Spring Boot Security with JWT Technical requirements Understanding CORS How CORS works Adding a CORS policy CORS applications for each method CORS applications at the controller level CORS application at the controller and method levels Global CORS configuration Understanding Spring Security Features of Spring Security Authentication and authorization in Spring Boot Configuring Spring Boot and implementing authentication Creating user endpoints JWT IDaaS Types of IDaaS Summary Chapter 8: Logging Events in Spring Boot Technical requirements Getting started with SLF4J and Log4j2 Features of a logging framework Logging using SLF4J Methods and classes of SLF4J Features of SLF4J Logging using Log4j2 The Log4j2 Logger Log4j2 Appenders Log4j2 Layouts Log4j2 Markers Log4j2 Filters Setting up SLF4J and Log4j2 Configuring Logback Configuring Log4j2 Using logs Annotations in Lombok Summary Chapter 9: Writing Tests in Spring Boot Technical requirements Understanding JUnit and AssertJ JUnit framework Assertions in JUnit Annotations Using AssertJ Character assertions Class assertions Iterable assertions File assertions Map assertions Writing a test Testing with the H2 database Testing a repository Writing tests in a service using Mockito Adding behavior Verifying behavior Expecting calls Exception handling Mockito in Spring Boot Summary Part 3: Frontend Development Chapter 10: Setting Up Our Angular Project and Architecture Technical requirements Organizing features and modules Generating an Angular project Angular features Creating the Angular folder structure Implementing the structure Structuring components Smart and dumb or presentation components Implementing smart and dumb components in the project Adding Angular Material Configuring Angular Material Implementing Angular Material Summary Chapter 11: Building Reactive Forms Technical requirements Understanding reactive forms The template-driven approach The reactive approach Basic form controls Form control methods Initializing form controls Resetting form controls Listening to events Grouping form controls Creating form groups Creating nested form groups Creating form arrays Using the FormBuilder service to generate controls Validating form input Built-in validators Custom validators Implementing reactive forms in our project Summary Chapter 12: Managing States with NgRx Technical requirements Understanding complexities in managing the states of large applications The flow of data without state management The flow of data with state management State management and the global state Global state/store Actions Reducers Selectors Effects Getting started and setting up NgRx Adding NgRx to our Angular project Installing NgRx DevTools Writing an action Implementing actions in the project Writing an effect Writing a reducer The state interface The initial state The reducer function Writing a selector and using a selector and dispatching it in a component Selecting root states Selecting feature states Implementing selectors in our project Configuring the store Runtime checks Summary Chapter 13: Saving, Deleting, and Updating with NgRx Technical requirements Removing an item without a side effect using NgRx Creating the delete action Creating the delete reducer Dispatching the action Removing an item with side effects using NgRx Creating a new action type Creating the delete effect Modifying the dispatch Adding an item with side effects using NgRx Creating the actions Creating the effect Creating the reducer Dispatching the action Updating an item with a side effect using NgRx Creating the actions Creating the effect Creating the reducer Dispatching the action Summary Chapter 14: Adding Authentication in Angular Technical requirements Adding user authentication The authentication API The HTTP interceptor The authentication module The routing module Protecting routes Project implementation Calling an API Creating the actions Creating the effects Creating the reducers Creating the selectors Syncing in local storage Dispatching and selecting a component Summary Chapter 15: Writing Tests in Angular Technical requirements Getting started with Cypress Installation Updating the Cypress config file Writing Cypress tests Mocking HTTP responses and intercepting HTTP requests Summary Part 4: Deployment Chapter 16: Packaging Backend and Frontend with Maven Technical requirements What is frontend-maven-plugin? Adding configurations to Spring Boot and Angular’s integration Adding the Angular app to the Spring Boot project Using frontend-maven-plugin Using maven-antrun-plugin Implementing WebMvcConfigurer Packaging Spring Boot Running the JAR file Summary Chapter 17: Deploying Spring Boot and the Angular App Technical requirements Understanding GitHub Actions Components of GitHub Actions Setting up Heroku Creating GitHub and Heroku accounts Creating a new app in Heroku Adding a Postgres database Adding system properties Adding config variables Manual deployment in Heroku Creating a CI workflow or pipeline Summary Index Why subscribe? Other Books You May Enjoy Packt is searching for authors like you Share Your Thoughts Download a free PDF copy of this book
Donate to keep this site alive
How to download source code?
1. Go to: https://github.com/PacktPublishing
2. In the Find a repository… box, search the book title: Spring Boot and Angular: Hands-on full stack web development with Java, Spring, and Angular
, sometime you may not get the results, please search the main title.
3. Click the book title in the search results.
3. Click Code to download.
1. Disable the AdBlock plugin. Otherwise, you may not get any links.
2. Solve the CAPTCHA.
3. Click download link.
4. Lead to download server to download.