Spring structure diagram

Data Access / Integration
Web
AOP
Aspects
Instrumentation
Messaging
Core Container






Beans
Core
Context
SpEL
Test
Web%3CmxGraphModel%3E%3Croot%3E%3CmxCell%20id%3D%220%22%2F%3E%3CmxCell%20id%3D%221%22%20parent%3D%220%22%2F%3E%3CmxCell%20id%3D%222%22%20value%3D%22%26lt%3Bspan%20style%3D%26quot%3Bcolor%3A%20rgba(0%20%2C%200%20%2C%200%20%2C%200)%20%3B%20font-family%3A%20monospace%20%3B%20font-size%3A%200px%26quot%3B%26gt%3B%253CmxGraphModel%253E%253Croot%253E%253CmxCell%2520id%253D%25220%2522%252F%253E%253CmxCell%2520id%253D%25221%2522%2520parent%253D%25220%2522%252F%253E%253CmxCell%2520id%253D%25222%2522%2520value%253D%2522%2522%2520style%253D%2522rounded%253D1%253BwhiteSpace%253Dwrap%253Bhtml%253D1%253B%2522%2520vertex%253D%25221%2522%2520parent%253D%25221%2522%253E%253CmxGeometry%2520x%253D%2522150%2522%2520y%253D%2522470%2522%2520width%253D%2522110%2522%2520height%253D%252280%2522%2520as%253D%2522geometry%2522%252F%253E%253C%252FmxCell%253E%253CmxCell%2520id%253D%25223%2522%2520value%253D%2522%2522%2520style%253D%2522rounded%253D1%253BwhiteSpace%253Dwrap%253Bhtml%253D1%253B%2522%2520vertex%253D%25221%2522%2520parent%253D%25221%2522%253E%253CmxGeometry%2520x%253D%2522270%2522%2520y%253D%2522470%2522%2520width%253D%2522110%2522%2520height%253D%252280%2522%2520as%253D%2522geometry%2522%252F%253E%253C%252FmxCell%253E%253C%252Froot%253E%253C%252FmxGraphModel%253E%26lt%3B%2Fspan%26gt%3B%22%20style%3D%22rounded%3D1%3BwhiteSpace%3Dwrap%3Bhtml%3D1%3B%22%20vertex%3D%221%22%20parent%3D%221%22%3E%3CmxGeometry%20x%3D%22430%22%20y%3D%22170%22%20width%3D%2290%22%20height%3D%2250%22%20as%3D%22geometry%22%2F%3E%3C%2FmxCell%3E%3CmxCell%20id%3D%223%22%20value%3D%22%26lt%3Bspan%20style%3D%26quot%3Bcolor%3A%20rgba(0%20%2C%200%20%2C%200%20%2C%200)%20%3B%20font-family%3A%20monospace%20%3B%20font-size%3A%200px%26quot%3B%26gt%3B%253CmxGraphModel%253E%253Croot%253E%253CmxCell%2520id%253D%25220%2522%252F%253E%253CmxCell%2520id%253D%25221%2522%2520parent%253D%25220%2522%252F%253E%253CmxCell%2520id%253D%25222%2522%2520value%253D%2522%2522%2520style%253D%2522rounded%253D1%253BwhiteSpace%253Dwrap%253Bhtml%253D1%253B%2522%2520vertex%253D%25221%2522%2520parent%253D%25221%2522%253E%253CmxGeometry%2520x%253D%2522150%2522%2520y%253D%2522470%2522%2520width%253D%2522110%2522%2520height%253D%252280%2522%2520as%253D%2522geometry%2522%252F%253E%253C%252FmxCell%253E%253CmxCell%2520id%253D%25223%2522%2520value%253D%2522%2522%2520style%253D%2522rounded%253D1%253BwhiteSpace%253Dwrap%253Bhtml%253D1%253B%2522%2520vertex%253D%25221%2522%2520parent%253D%25221%2522%253E%253CmxGeometry%2520x%253D%2522270%2522%2520y%253D%2522470%2522%2520width%253D%2522110%2522%2520height%253D%252280%2522%2520as%253D%2522geometry%2522%252F%253E%253C%252FmxCell%253E%253C%252Froot%253E%253C%252FmxGraphModel%253E%26lt%3B%2Fspan%26gt%3B%22%20style%3D%22rounded%3D1%3BwhiteSpace%3Dwrap%3Bhtml%3D1%3B%22%20vertex%3D%221%22%20parent%3D%221%22%3E%3CmxGeometry%20x%3D%22534%22%20y%3D%22170%22%20width%3D%2290%22%20height%3D%2250%22%20as%3D%22geometry%22%2F%3E%3C%2FmxCell%3E%3C%2Froot%3E%3C%2FmxGraphModel%3E
sockets
Servlet
Web
Portlet
JDBC
ORM
OXM
JMS
Transcation
Data Source API
JDBC Application
Physical Pooled
Connection Object
JDBC Driver
Logical Connection Object
Connection Pool DataSource API
Application Server
Cache of Pooled Connection objects
A software component that enables a Java application to interact with a database
Connection Object is the session between java application and the database
JDBC
ORM
Java database connectivity
Object relational mapping
Mechanism that makes it possible to address, access and manipulate objects without having to consider how those objects relate to their data source
Hibername, JDO, Oracle TopLink, iBATIS, SQL MAPs, JPA
JPA architecture
Entity
Manages
Creates
Creates
Entity
manager
Creates
Entity
Manager
Factory
Creates
Persistence
Query%3CmxGraphModel%3E%3Croot%3E%3CmxCell%20id%3D%220%22%2F%3E%3CmxCell%20id%3D%221%22%20parent%3D%220%22%2F%3E%3CmxCell%20id%3D%222%22%20value%3D%22Entity%26lt%3Bbr%26gt%3Bmanager%22%20style%3D%22rounded%3D1%3BwhiteSpace%3Dwrap%3Bhtml%3D1%3BstrokeWidth%3D1%3B%22%20vertex%3D%221%22%20parent%3D%221%22%3E%3CmxGeometry%20x%3D%221120%22%20y%3D%22387%22%20width%3D%2280%22%20height%3D%2260%22%20as%3D%22geometry%22%2F%3E%3C%2FmxCell%3E%3C%2Froot%3E%3C%2FmxGraphModel%3E
Criteria
Entity
transaction
Configures
Persistence unit
Creates and manages multiple entity manager instances
An interfage that manages the persistence operations on objects
Persistence context
A persistence context is a set of entity instances in which for any persistent entity identity there is a unique entity instance. Within the persistence context, the entity instances and their lifecycle are managed. The EntityManager API is used to create and remove persistent entity instances, to find entities by their primary key, and to query over entities.
It has one-to-one relationship with EntityManager. For each EntityManager, operations are maintained by EntityTransaction class.
Implemented by each JPA vendor to obtain relational objects that meet the criteria
JPA annotations
OXM
Spring Object XML Mapper
Ease the mapping between java objects and XML documents
Fragment1
<customer>
...
</customer>
Fragment2
<customer>
...
</customer>
Fragment3
<customer>
...
</customer>
Spring OXM
Servlet
Search view 
using the information
from controller
Check if there is
already mapped
controller
Dispatcher
Servlet
(Front controller)
Handle request and
return name of the view
that will show result
Controller
Send view
Handle request

Create model
model
Incoming request
Return response
Servlet engine
Send
result
View resolver
View
model
Handle request
Handler mapping
A class which responds to a particular type of network request (mostly HTTP)
Web
Sockets
Web Socket is an application protocol that provides full-duplex communications between 2 peers over the TCP protocol. In the traditional request-response model used in HTTP, the server cannot initiate connection unless client requesting first. Web Socket protocol addresses these limitations by providing a full duplex communication channel between the client and the server. Combined with other client technologies, Web socket enables web application to deliver a richer user experience
Polling .....
Transaction
A database transaction is a sequence of actions that are treated as a single unit of work. These actions should either complete entirely or take no effect at all. Transaction is important part of RDBMS oriented enterprise application to ensure data integrity and consistency. 
Atomicity
A transaction should be treated as a single unit of operation, which means either the entire sequence of operation is successful or unsuccessful
Consistency
This represents the consistency of the referential integrity of the database, unique primary keys in tables, etc
Isolation
There may be many transaction processing with the same data set at the same time. Each transaction should be isolated from others to prevent data corruption.
Durability
Once a transaction has completed, the results of this transaction have to be made permanent and cannot be erased from the database due to system failure. 
Caller invokes proxy
not target
Caller
Transaction created on way in, 
committed or rolled back on way out
AOP
Proxy
Transaction
Advisor
Custom interceptors may run
before or after transaction
advisor
Custom
Advisor
Target
Method
Control flows back through interceptor chain to return result to caller
Business logic invoked
AOP terminology
AOP
Aspect Oriented Programming entails breaking down program logic into distinct parts called concerns. The functions that span multiple points of an application are called cross cutting concerns and these cross cutting concerns are conceptually separate from the application's business logic. There are good examples of aspects like logging, auditing, declarative transactions, security, caching, etc
Aspect
This is a module which has a set of APIs providing cross cutting requirements. For example, a logging module would be called AOP aspects for logging. An application can have any number of aspects depending on the requirement
Joint
Point
This represents a point in your application where you can plug in the AOP aspect. This is the actual place where an action will be taken using Spring AOP framework.
Advice
This is the actual action to be taken either before or after the method execution. This is an actual piece of code that is invoked during the program execution by Spring AOP framework.
Pointcut
This is a set of one or more join points where an advice should be executed. You can specify pointcuts using expressions or patterns as we will see in our AOP examples
Introduction
An introduction allows you to add new methods or attributes to the existing classes 
Target
object
The object being advised by one or more aspects. This object will always be proxied object, also referred to as advised object.
Weaving
Is a process of linking aspects with other application types or objects to create an advised object.
Types of acvice
JDBS is a JAVA API that manages connecting to a database, issuing queries and commands, and handling result sets obtained from the database. 
javax.servlet
javax.servlet.http
before
Run advice before the method execution
after
Run advice after the method execution, regardless of its out come
after-running
Run advice after the method execution only if method completes successfully
after-throwing
Run advice after the method execution only if method exits by throwing an exception 
around
Run advice before and after the advised method is invoked
Aspects
An aspect is a class that implements concerns that cut across multiple classes
1. Aspects can be a normal class configured      though XML 
2. Spring AspectJ using @Aspect annotation
Instrumentation
Review application performance through AOP and logging
Logging API
Performance API
Business state changes
Beginning and ending of major business transactions
Resource creation and deletion
Events related to performance and reliabililty
Logging events
Monitoring database activities
Code tracing : tracing information message about the execution of an application at run time
Performance monitoring 
Out of box statistical monitors(CPU, Memory, Network, Storage etc...)
Custom specific statistical monitors(average time for specific method)
Custom counters for events of interest(exceptions, cache, etc...)
Bean
The objects that form the backbone of your application and that are managed by the Spring IoC container are called beans. A bean is an object that is instantiated, assembled, and otherwise managed by a Spring IoC container.
IoC ??
Inversion of Control
A process in which an object defines its dependencies without creating them. This object delegates the job of constructing such dependencies to an IoC container. 
Scope of beans
Singleton
Container creates a single instance of that bean. All requests for that bean name will return the same object, which is cached. Any modifications to the object will be reflected in all references to the bean. This scope is the default value if no other scope is specified.
Prototype
A bean with the prototype scope will return a different instance every time it is requested from the container. It is defined by setting the value prototype to the @Scope annotation in the bean definition.
Instantiate Bean
Populate properties
BeanNameAware
.setBeanName()
BeanFactoryAware
.setBeanFactory()
ApplicationContextAware
.setApplicationContext()
Bean Ready
to be used 
Custom configured
init-method()
InitializingBean
.afterPropertiesSet()
Method with 
@PostConstruct
Bean PostProcessors
preinitialization()
Spring Cont%3CmxGraphModel%3E%3Croot%3E%3CmxCell%20id%3D%220%22%2F%3E%3CmxCell%20id%3D%221%22%20parent%3D%220%22%2F%3E%3CmxCell%20id%3D%222%22%20value%3D%22Custom%20configured%26lt%3Bbr%26gt%3Binit-method()%22%20style%3D%22rounded%3D1%3BwhiteSpace%3Dwrap%3Bhtml%3D1%3Bshadow%3D0%3Bglass%3D0%3Bsketch%3D0%3B%22%20vertex%3D%221%22%20parent%3D%221%22%3E%3CmxGeometry%20x%3D%222470%22%20y%3D%22560%22%20width%3D%22120%22%20height%3D%2260%22%20as%3D%22geometry%22%2F%3E%3C%2FmxCell%3E%3C%2Froot%3E%3C%2FmxGraphModel%3Eainer
shutdown
@PreDestroy
Custom Destroy method
DisposalBean
.destroy()
End
Bean
Class
Name of the java class
Id
Unique identifier
Scope
Scope of the bean object
Constructor
arguments
Property
Arguments that will be passed to the constructor
Arguments that will be passed to bean setter

Comments

Post a Comment

Popular posts from this blog

Structures of JAVA

What is URI(URN, URL)

Spring Boot JPA - Pagination

Spring Boot JPA - What is JPA, Entity, Repository

Java Data Structures VS Python, C/C++ Data Structures

Design Pattern - Proxy