Spring Boot-Notes
Spring Boot-Notes
-project.mode=development
after setting this up in application.properties file now set
@ConditionalOnProperty(name="project.mode", havingValue="development")
|
Property jo define ki hai uske upar kuch conditions hai
- kisi bhi project ka ham envrment variable define kar sakte hai (similar to env
variable we have in os) which will have precedence over the configuration set in
application.properties
- Spring MVC
Spring MVC is a part of the Spring Framework that implements the MVC design
pattern. It provides a flexible way to build web applications and REST APIs by
following the MVC architecture. Here’s a basic overview:
Model: In Spring MVC, the model can be represented by POJOs (Plain Old Java
Objects) or data entities that are used to store and manipulate data. These models
are usually populated from the database and passed to the view.
View: Spring MVC supports various view technologies like JSP (JavaServer Pages),
Thymeleaf, and FreeMarker. The view is responsible for rendering the data from the
model into a format that can be presented to the user.
Controller: The controller in Spring MVC is a Java class annotated with @Controller
or @RestController. It handles incoming HTTP requests, processes them (often
involving the model), and returns the appropriate view or data.
Purpose: This annotation binds the HTTP request body to the User parameter. It
tells Spring to convert the incoming JSON data (in the request body) into a User
object.
Usage: When a client sends a POST request with a JSON payload, @RequestBody will
deserialize this JSON into a User object.