0% found this document useful (0 votes)
12 views2 pages

Annotations

The document describes various annotations used in Spring and Java frameworks: - Spring annotations like @Bean, @Service, @Repository, @Configuration, @Controller, @ComponentScan, @RequestMapping, @Autowired, @SpringBootApplication, @EnableAutoConfiguration, @PathVariable, and @RequestBody are used to define beans, services, controllers and configure Spring applications. - JPA annotations like @Entity, @Id, and @Table are used to define entities and their mapping to database tables. @Id specifies the primary key and @GeneratedValue specifies primary key generation strategies. - JSON is used to serialize and deserialize objects to and from strings for data transfer.

Uploaded by

shyam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views2 pages

Annotations

The document describes various annotations used in Spring and Java frameworks: - Spring annotations like @Bean, @Service, @Repository, @Configuration, @Controller, @ComponentScan, @RequestMapping, @Autowired, @SpringBootApplication, @EnableAutoConfiguration, @PathVariable, and @RequestBody are used to define beans, services, controllers and configure Spring applications. - JPA annotations like @Entity, @Id, and @Table are used to define entities and their mapping to database tables. @Id specifies the primary key and @GeneratedValue specifies primary key generation strategies. - JSON is used to serialize and deserialize objects to and from strings for data transfer.

Uploaded by

shyam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Annotations

 @Bean - indicates that a method produces a bean to be managed by IOC


container.
 @Service - indicates that an annotated class is a service class.
 @Repository - indicates that an annotated class is a repository, which is an
abstraction of data access and storage.
 @Configuration - indicates that a class is a configuration class that may
contain bean definitions.
 @Controller - marks the class as web controller, capable of handling the
requests.
 @Component
 @ComponentScan – scans a bean to make it visible for the ioc container.
 @RequestMapping - maps HTTP request with a path to a controller
method.
 @Autowired - marks a constructor, field, or setter method to be autowired
by Spring dependency injection.
 @SpringBootApplication - enables Spring Boot autoconfiguration and
component scanning.
 @EnableAutoConfiguration – automatically configures spring boot
application, based on the jar dependency we have added in the pom.xml
file.
 @PathVariable - used to handle template variables in the request URI
mapping, and set them as method parameters.
 @RequestBody – used to deserialize the request body to the object which is
the parameter of the handler method.

JSON is a format that encodes objects in a string. Serialization means to convert


an object into that string, and deserialization is its inverse operation
(convert string -> object).
ORM annotations:-

Each entity must have at least two annotations defined: 


@Entity and @Id.
The @Entity annotation specifies that the class is an entity and is mapped to a
database table.
The @Table annotation specifies the name of the database table to be used for
mapping.
The @Id annotation specifies the primary key of an entity
the @GeneratedValue provides for the specification of generation strategies for
the values of primary keys.

You might also like