Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Spring 5.0 Projects

You're reading from   Spring 5.0 Projects Build seven web development projects with Spring MVC, Angular 6, JHipster, WebFlux, and Spring Boot 2

Arrow left icon
Product type Paperback
Published in Feb 2019
Publisher Packt
ISBN-13 9781788390415
Length 442 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Nilang Patel Nilang Patel
Author Profile Icon Nilang Patel
Nilang Patel
Arrow right icon
View More author details
Toc

Table of Contents (9) Chapters Close

Preface 1. Creating an Application to List World Countries with their GDP FREE CHAPTER 2. Building a Reactive Web Application 3. Blogpress - A Simple Blog Management System 4. Building a Central Authentication Server 5. An Application to View Countries and their GDP using JHipster 6. Creating an Online Bookstore 7. Task Management System Using Spring and Kotlin 8. Other Books You May Enjoy

Spring Model-View-Controller web flow

The next step is to add Spring MVC capabilities. In the previous step, the required starter dependencies for the web are added to the pom.xml file. Next, we will define Spring MVC artifacts in our application.

Since this is a Spring Boot application, we are not required to declare everything from scratch. It is essential to define the controllers and view layer. First, we will declare a Spring MVC controller, as in the following snippet:

@Controller
public class BlogController {
private Logger logger = LoggerFactory.getLogger(BlogController.class);
@GetMapping("/")
public String showLandingPage(Model model) {
logger.info("This is show home page method ");
return "home";
}
}

The @Controller annotation describes this class as a Spring MVC controller. It basically instructs the Spring Boot application...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image