**1.@SpringBootApplication **is a key annotation in Spring Boot, used to mark the main class of a Spring Boot application.
2.@ConfigurationIndicates that the class can be used by the Spring IoC container as a source of bean definitions.
3.@EnableAutoConfigurationTells Spring Boot to start adding beans based on classpath settings, other beans, and various property settings. For example, if Spring MVC is on the classpath, it auto-configures a web application.
4.@ComponentScanells Spring to look for other components, configurations, and services in the package, allowing it to find the controllers and other beans you create.
5.@Controlleris a Spring annotation used to define a web controller in a Spring MVC application. It tells Spring that the class is a web controller, which will handle HTTP requests (like GET and POST) and return views (usually HTML pages using Thymeleaf, JSP, etc.).
When to use @Controller:
When you're building web applications with Spring MVC.
When you want to return a view name (like a .html page) instead of raw data (for that, you'd use @RestController).
6.@GetMapping is a Spring annotation used to handle HTTP GET requests in a Spring MVC application.
7.@PostMapping is used in Spring to handle HTTP POST requests, typically for form submissions or sending data to the server (like in APIs).
8.@SessionAttributes It's an annotation used in Spring MVC to store data in the session so it stays available across multiple pages or requests.
Why use it?
Normally, attributes you add to the Model are only available for one request.
@SessionAttributes lets you persist specific model attributes in the user's session — useful for things like:
Multi-page forms
Keeping user info like username or email during login sessions
9.@RestController @RestController is used in Spring Boot to create REST APIs — it means:“This class handles web requests and returns data, not HTML pages.”
When to use it?
When you're building a backend API.
When your frontend (like React or Angular) calls your Spring app to get JSON data.
10.@CrossOrigin @CrossOrigin is a Spring annotation that allows your backend (Spring app) to accept requests from a different domain, port, or protocol.
This is useful when:
Your frontend (e.g., React, Angular) is hosted on a different server than your backend (Spring).
11.@Entity is a JPA annotation used to mark a class as an entity — meaning it represents a table in the database.
When you use
@Entity on a class, Spring (or any JPA-based framework) knows that this class should be stored in the database as a table.
🔸 Why use it?
You use @Entity when you want to store objects of a class in the database and perform CRUD operations (Create, Read, Update, Delete).
**12.@id **is a JPA annotation used to specify the primary key of an entity (a unique identifier for each record in a database table).
**13.@GeneratedValue **is a JPA annotation used with @id to specify how the primary key should be generated automatically when a new record is inserted into the database.
**14.@ManyToOne **is a JPA annotation used to specify a many-to-one relationship between two entities. It indicates that many instances of the current entity are associated with one instance of another entity.
15.@JoinColumn(name = "customer_id"): Specifies the foreign key column in the Order table that references the primary key of Customer.
16.@OneToMany(mappedBy = "customer"): In the Customer entity, this defines the inverse side of the relationship, stating that orders are mapped by the customer field in the Order entity.
17.@Table is a JPA annotation used to specify the details of the database table that an entity class is mapped to. By default, JPA will map an entity to a table with the same name as the class, but with @Table, you can customize the table's name and other properties.
Why use it?
You want to change the default table name.
18.@Repository is a Spring annotation used to define a Data Access Object (DAO) — a class responsible for interacting with the database.
**19.@Service **is a Spring annotation used to mark a class as a service layer component. It is a specialization of the @Component annotation, meaning Spring will treat it as a Spring bean and manage its lifecycle (just like any other bean). The service layer typically contains business logic and acts as an intermediary between the controller layer (which handles HTTP requests) and the repository layer (which handles data access).
20.@Autowired is a Spring annotation used to automatically inject dependencies into a Spring bean. It allows you to wire up your beans without needing to manually instantiate them. Spring will automatically resolve and inject the dependencies based on the type of the bean.
21.@Getter and @setter:
Both of these annotations are from Lombok and are used to generate getter and setter methods for the fields in your class.
@Getter: Generates getter methods for all fields.
@setter: Generates setter methods for all fields.
22.@AllArgsConstructor:This annotation, also from Lombok, generates a constructor with arguments for all the fields in your class. It helps in cases where you want to create instances of your class with all properties set at once.
23.@NoArgsConstructor:This annotation is from Lombok. It generates a no-arguments constructor for your class at compile-time. A no-arguments constructor is particularly useful when your class is used with frameworks like Spring, which require a default constructor to instantiate objects using reflection.
24.@JsonIgnoreProperties(ignoreUnknown = true):
This annotation is provided by Jackson, the JSON processor used in Spring applications. It tells Jackson to ignore any unknown properties that are encountered during the deserialization of a JSON object. This is especially useful when you're working with external JSON APIs, or if the structure of your JSON might