Java 005
Java 005
x)
I. Introduction to Spring
1. What is Spring?
Spring is an open-source framework used for building enterprise applications in Java. It provides comprehensive infr
tures like Dependency Injection (DI), Aspect-Oriented Programming (AOP), and transaction management.
5. Bean Scopes -
Singleton: Only one instance of the bean is created.
Prototype: A new instance is created every time it is requested.
Request: A new instance is created for each HTTP request (used in web applications).
Session: A new instance is created for each HTTP session.
Global Session: A new instance for each global HTTP session.
6. What is Autowiring?
Autowiring is a feature that allows Spring to automatically inject dependencies into beans without needing to specify
11. How can we use Spring to create Restful Web Service returning JSON response?
You can use @RestController and @RequestMapping annotations to create RESTful web services that return JSON re
t.
@Component, @Service, @Repository
15. What is Aspect, Advice, Pointcut, JointPoint, and Advice Arguments in AOP?
Aspect: A module that contains cross-cutting concerns.
Advice: Code that is executed when a pointcut expression matches a method execution.
Pointcut: Expression that defines where advice should be applied (methods).
JointPoint: A point in the program execution where an aspect can be applied (usually method executions).
Advice Arguments: Parameters passed to advice methods that allow them to work with the targeted methods.
Association Mappings:
One-to-One: Use @OneToOne annotation to define a one-to-one relationship.
One-to-Many: Use @OneToMany annotation to define a one-to-many relationship.
Many-to-One: Use @ManyToOne annotation to define a many-to-one relationship.
Many-to-Many: Use @ManyToMany annotation to define a many-to-many relationship.
V. Hibernate Caching