In Spring Boot, which is part of the larger Spring Framework, @RestController and @Controller are two annotations used for different purposes, though they are related to how HTTP requests are handled in a web application. In this tutorial, I will show you the difference between @RestController vs @Controller.
Tag: spring boot 3
Spring Data REST example in Spring Boot
In this tutorial, we’re gonna build a Spring Data REST example in Spring Boot CRUD REST API with Maven that uses Spring Data JPA to interact with H2 database without having to manually implement controller and handling HTTP requests. You’ll know:
- How to configure Spring Data REST, JPA, Hibernate to work with Database
- How to define Data Models and Repository interfaces
- Way to use Spring Data JPA to interact with H2 Database
- How to check CRUD operations with Postman
More Practice:
– Spring JPA @Query example
– JPA Repository query example | Derived Query
– JPA Native Query example
– Spring Boot Security Login example with JWT and H2 Database
– Spring Boot Rest XML example
– Spring Boot + GraphQL example
– Spring Boot Multipart File upload example
– Documentation: Spring Boot + Swagger 3 example (with OpenAPI 3)
– Caching: Spring Boot Redis Cache example
– Testing: Spring Boot Unit Test for JPA Repository
Associations:
– Spring Boot One To One example with JPA, Hibernate
– Spring Boot One To Many example with JPA, Hibernate
– Spring Boot Many to Many example with JPA, Hibernate
Validate Request Body in Spring Boot
In this tutorial, I will show you how to validate Request Body using Validation annotations in Spring Boot Rest API.
More Practice:
– Spring Boot custom Validation example
– Spring Boot Login and Registration example
– Spring Boot 3 Rest API CRUD example
– Spring Boot @ControllerAdvice & @ExceptionHandler example
– Spring Boot Unit Test for Rest Controller
– Documentation: Spring Boot Swagger 3 example
– Caching: Spring Boot Redis Cache example
– Spring Boot + GraphQL example
Spring Boot custom Validation example
Data validation is very important. It conforms to the expected format, type, range, and business rules, as well as identify and prevent errors, inconsistencies, and fraud. When we need to perform data validation that cannot be handled by the built-in validation annotations provided by Spring Framework, we can use custom validation to define our own rules and constraints. In this tutorial, I will show you how to implement custom Validation annotation in Spring Boot example (with Rest API).
More Practice:
– Spring Boot Validation annotations
– Spring Boot Login and Registration example
– Spring Boot 3 Rest API CRUD example
– Spring Boot @ControllerAdvice & @ExceptionHandler example
– Spring Boot Unit Test for Rest Controller
– Documentation: Spring Boot Swagger 3 example
– Caching: Spring Boot Redis Cache example
– Spring Boot + GraphQL example
Spring WebFlux File download example
In this tutorial, I will show you File download using Spring WebFlux example.
This Spring Boot App works with:
– Angular 8 / Angular 10 / Angular 11 / Angular 12 / Angular 13 / Angular 14 / Angular 15
– Angular Material 12
– Vue Client / Vuetify Client
– React Client / React Hooks Client
– React Image Upload with Preview
– Material UI Client
– Axios Client
Related Posts:
– Spring Boot Delete File example
– Spring Boot WebFlux Rest API example
– Spring Boot Thymeleaf File Upload example
– How to upload multiple files in Java Spring Boot
– Spring Boot Upload/Download File to/from Database example
– Spring Boot: Upload/Import Excel file data into MySQL Database
– Spring Boot: Upload/Import CSV file data into MySQL Database
– Documentation: Spring Boot Swagger 3 example
– Caching: Spring Boot Redis Cache example
Deployment: Deploy Spring Boot App on AWS – Elastic Beanstalk
