Spring Boot
Spring boot is a technology which has been built over Spring framework itself. Spring boot
provides auto configuration for our Spring based projects. Spring boot provides its own JPA
called as Spring Data JPA which has been built over JPA which is implemented by Hibernate
framework.
Every Spring boot project will have a dedicated server which will be auto configured by the
Spring itself. Spring boot uses Apache tomcat as a web server.
Spring boot can be used to develop monolithic applications but it is widely used for
developing server-side applications.
Since client-side applications and server-side applications are developed using different
programming languages that leads to incompatibility between server-side applications and
client-side applications. But in order to make client-side application communicate with
server-side application, we must develop an API layer which will be a part of server-side
application.
Those API's can be implemented or developed using different architectures
1. SOAP architecture
SOAP stands for simple object access protocol. Which is a protocol nothing but set of rules
and regulations which have to be followed in order to develop API's. SOAP architecture
supports XML (extensible markup language) in order to transfer data from client-side
application to server-side application and vice-versa, which is the limitation of SOAP
architecture, that’s why REST architecture is widely used in the development of API's.
2. REST architecture
REST stands for representational state transfer. It is the way of developing APIs without any
protocols, along with this, REST architecture supports transfer of data from client-side
application to server-side application and vice-versa in JSON format.
Spring boot can be used to implement web services or microservices.
Webservice : it is a server side application which will provide a service for multiple clients on
the web that's why it is called as webservice
Microservice : it is a webservice itself but in small scale. The server-side application will be
divided into small modules in order to maintain the server-side application in more
efficient way. Those small modules are called as microservices.
Annotations used in spring Boot
@SpringBootApplication
---------------------
this annotation is a combination of @componentScan and @EnableAutoCnfiguration. This
annotation is used for the configuration of spring boot project automatically.
@RestController
--------------
it is a combination of @Controller and @ResponseBody. This annotation is used to mark the
class as rest controller class.
@ResponseBody
-------------
this annotation is responsible for marshalling process. Marshalling is a process of converting
the java object into JSON.
@RequestBody
-----------
this annotation is responsible for unmarshalling. Unmarshalling is the process of converting
the JSON into java object.
@PostMapping
------------
this annotation is the combination of @RequestMapping and with the http method as Post.
For sending the data
@GetMapping
------------
this annotation is the combination of @RequestMapping and with the http method as Get.
For fetching the data
@PutMapping
------------
this annotation is the combination of @RequestMapping and with the http method as Put.
For updating the existing data
@DeleteMapping
------------
this annotation is the combination of @RequestMapping and with the http method as
Delete. For deleting the existing the data.
@Service
--------
this annotation is a specialize form of @Component annotation.
@Repository
-----------
this annotation is the specialized form of @Component which is used to mark an interface as
repository.