- @Controller: We use @Controller to declare our class as our Controller class. It is specialization of @component and is autodetected through class path scanning.
- @RestController: @RestControlleris a sibling convenience annotation to create RESTful controllers. It adds the @Controller and @ResponseBody It converts the response to JSON or XML.
- @RequestMapping: We use @RequestMapping to map HTTP requests to handler methods of MVC and REST.
- @requestParam: @RequestParamis a Spring annotation used to bind a web request parameter to a method parameter.
- @PathVariable: @PathVariableis a Spring annotation which indicates that a method parameter should be bound to a URI template variable.
- @Service: @Service is used to declare a class as a service class which is also a specialization of @component.
- @Repository: @Repository is used to declare a class as repository class which is used to store, retrieve, update an delete an object.
- @entity: @entity is used to specify a class as an entity class.
- @table: @table specifies the primary table for the annotated entity.
- @Autowired: @autowired annotation is used for automatic dependency injection.
- @Id: The @Idannotation marks a field as a primary key field. When a primary key field is defined the primary key value is automatically injected into that field by ObjectDB.
- @Column: Is used to specify the mapped column for a persistent property or field. If no Columnannotation is specified, the default values apply.
- @GeneratedValue: The @GeneratedValueannotation specifies that the primary key is automatically allocated by ObjectDB.
- @nonNull: This annotation is used to set the default behavior to non-nullable in order to avoid annotating your whole codebase with @NonNull.
- @EnableAutoConfiguration: This annotation is used to automatically configure your application based on the dependencies you have added.
- @SpringBootApplication: This annotation is used in the class from where the execution of Spring Boot Application should start.
- @ComponentScan: This annotation is used to scan all the components included in Spring Boot project.
note: In Spring Boot, if we are using @SpringBootApplication then we don’t need to add other annotations like @EnableAutoConfiguration, @ComponentScan, @SpringBootConfiguration. Make sure in whichever class @SpringBootApplication is used it should have a main method. We will be discussing more about these annotations and their use further in our tutorial.
- GET: The GET method is used to retrieve information from the given server using a given URI. Requests using GET should only retrieve data and should have no other effect on the data.
- POST: A POST request is used to send data to the server, for example, customer information, file upload, etc. using HTML forms.
- DELETE: Removes all the current representations of the target resource given by URI.
- PUT: Replaces all the current representations of the target resource with the uploaded content.