:
//1.BASICS OF SPRING
1.Spring does many things. But at the root of
almost everything Spring provides are a few foundational ideas, all focused on
Spring’s fundamental mission: Spring simplifies Java development.
2.To back up its attack on Java complexity, Spring employs four key strategies:
Lightweight and minimally invasive development with POJOs
Loose coupling through DI and interface orientation
Declarative programming through aspects and common conventions
Eliminating boilerplate code with aspects and templates
3.Spring avoids (as much as possible) littering your application code with its API.
Spring almost never forces you to implement a Spring-specific interface or extend a
Spring-specific class. Instead, the classes in a Spring-based application often have no
indication that they’re being used by Spring. At worst, a class may be annotated with
one of Spring’s annotations, but it’s otherwise a POJO.
//2.HOW DI WORKS
Traditionally, each object is responsible for obtaining its
own references to the objects it collaborates with (its dependencies). This can lead to
highly coupled and hard-to-test code.
The act of creating associations between application components is commonly
referred to as wiring.
In a Spring application, an application context loads bean definitions and wires them
together. The Spring application context is fully responsible for the creation of and
wiring of the objects that make up the application. Spring comes with several implementations
of its application context, each primarily differing only in how it loads its
configuration.
//3.WHAT IS ASPECTS .Aspects
Although DI makes it possible to tie software components together loosely, aspectoriented
programming (AOP) enables you to capture functionality that’s used
throughout your application in reusable components.
AOP is often defined as a technique that promotes separation of concerns in a software
system. Systems are composed of several components, each responsible for a specific
piece of functionality. But often these components also carry additional responsibilities
beyond their core functionality. System services such as logging, transaction
management, and security often find their way into components whose core responsibilities
is something else. These system services are commonly referred to as cross-cutting
concerns because they tend to cut across multiple components in a system
6.
AOP makes it possible to modularize these services and then apply them declaratively
to the components they should affect. This results in components that are more cohesive
and that focus on their own specific concerns, completely ignorant of any system
services that may be involved. In short, aspects ensure that POJOs remain plain.
7.
In a Spring-based application, your application
objects live in the Spring container.
As illustrated in figure 1.4, the container
creates the objects, wires them together,
configures them, and manages their complete
lifecycle from cradle to grave (or new
to finalize(), as the case may be).
8.
The container is at the core of the Spring Framework. Spring’s container uses DI to
manage the components that make up an application. This includes creating associations
between collaborating components. As such, these objects are cleaner and easier
to understand, they support reuse, and they’re easy to unit test.
There’s no single Spring container. Spring comes with several container implementations
that can be categorized into two distinct types. Bean factories (defined by
the org.springframework.beans.factory.BeanFactory interface) are the simplest
of containers, providing basic support for DI. Application contexts (defined by the
org.springframework.context.ApplicationContext interface)
//4.APPLICATION CONTEXT
Working with an application context
Spring comes with several flavors of application context. Here are a few that you’ll
most likely encounter:
AnnotationConfigApplicationContext—Loads a Spring application context
from one or more Java-based configuration classes
AnnotationConfigWebApplicationContext—Loads a Spring web application
context from one or more Java-based configuration classes
ClassPathXmlApplicationContext—Loads a context definition from one or
more XML files located in the classpath, treating context-definition files as classpath
resources
FileSystemXmlApplicationContext—Loads a context definition from one or
more XML files in the filesystem
XmlWebApplicationContext—Loads context definitions from one or more
XML files contained in a web application
10. //5.BEANS LIFE CYCLE
A bean’s life
Java’s new keyword is
used to instantiate the bean, and it’s ready to use. Once the bean is no longer in use,
it’s eligible for garbage collection and eventually goes to the big bit bucket in the sky.
Let’s break down figure 1.5 in more detail:
1 Spring instantiates the bean.
2 Spring injects values and bean references into the bean’s properties.
3 If the bean implements BeanNameAware, Spring passes the bean’s ID to the set-
BeanName() method.
4 If the bean implements BeanFactoryAware, Spring calls the setBeanFactory()
method, passing in the bean factory itself.
5 If the bean implements ApplicationContextAware, Spring calls the set-
ApplicationContext() method, passing in a reference to the enclosing application
context.
6 If the bean implements the BeanPostProcessor interface, Spring calls its post-
ProcessBeforeInitialization() method.
7 If the bean implements the InitializingBean interface, Spring calls its after-
PropertiesSet() method. Similarly, if the bean was declared with an initmethod,
then the specified initialization method is called.
8 If the bean implements BeanPostProcessor, Spring calls its postProcess-
AfterInitialization() method.
9 At this point, the bean is ready to be used by the application and remains in the
application context until the application context is destroyed.
10 .If the bean implements the DisposableBean interface, Spring calls its
destroy() method. Likewise, if the bean was declared with a destroy-method,
the specified method is called.
//6.SPRING REQUIRED LIB
As of Spring 4.0, there
are 20 distinct modules in the Spring
Framework distribution, with three JAR
files for each module
//7.SPRING ARCHITECHTURE
//1.BASICS OF SPRING
1.Spring does many things. But at the root of
almost everything Spring provides are a few foundational ideas, all focused on
Spring’s fundamental mission: Spring simplifies Java development.
2.To back up its attack on Java complexity, Spring employs four key strategies:
Lightweight and minimally invasive development with POJOs
Loose coupling through DI and interface orientation
Declarative programming through aspects and common conventions
Eliminating boilerplate code with aspects and templates
3.Spring avoids (as much as possible) littering your application code with its API.
Spring almost never forces you to implement a Spring-specific interface or extend a
Spring-specific class. Instead, the classes in a Spring-based application often have no
indication that they’re being used by Spring. At worst, a class may be annotated with
one of Spring’s annotations, but it’s otherwise a POJO.
//2.HOW DI WORKS
Traditionally, each object is responsible for obtaining its
own references to the objects it collaborates with (its dependencies). This can lead to
highly coupled and hard-to-test code.
The act of creating associations between application components is commonly
referred to as wiring.
In a Spring application, an application context loads bean definitions and wires them
together. The Spring application context is fully responsible for the creation of and
wiring of the objects that make up the application. Spring comes with several implementations
of its application context, each primarily differing only in how it loads its
configuration.
//3.WHAT IS ASPECTS .Aspects
Although DI makes it possible to tie software components together loosely, aspectoriented
programming (AOP) enables you to capture functionality that’s used
throughout your application in reusable components.
AOP is often defined as a technique that promotes separation of concerns in a software
system. Systems are composed of several components, each responsible for a specific
piece of functionality. But often these components also carry additional responsibilities
beyond their core functionality. System services such as logging, transaction
management, and security often find their way into components whose core responsibilities
is something else. These system services are commonly referred to as cross-cutting
concerns because they tend to cut across multiple components in a system
6.
AOP makes it possible to modularize these services and then apply them declaratively
to the components they should affect. This results in components that are more cohesive
and that focus on their own specific concerns, completely ignorant of any system
services that may be involved. In short, aspects ensure that POJOs remain plain.
7.
In a Spring-based application, your application
objects live in the Spring container.
As illustrated in figure 1.4, the container
creates the objects, wires them together,
configures them, and manages their complete
lifecycle from cradle to grave (or new
to finalize(), as the case may be).
8.
The container is at the core of the Spring Framework. Spring’s container uses DI to
manage the components that make up an application. This includes creating associations
between collaborating components. As such, these objects are cleaner and easier
to understand, they support reuse, and they’re easy to unit test.
There’s no single Spring container. Spring comes with several container implementations
that can be categorized into two distinct types. Bean factories (defined by
the org.springframework.beans.factory.BeanFactory interface) are the simplest
of containers, providing basic support for DI. Application contexts (defined by the
org.springframework.context.ApplicationContext interface)
//4.APPLICATION CONTEXT
Working with an application context
Spring comes with several flavors of application context. Here are a few that you’ll
most likely encounter:
AnnotationConfigApplicationContext—Loads a Spring application context
from one or more Java-based configuration classes
AnnotationConfigWebApplicationContext—Loads a Spring web application
context from one or more Java-based configuration classes
ClassPathXmlApplicationContext—Loads a context definition from one or
more XML files located in the classpath, treating context-definition files as classpath
resources
FileSystemXmlApplicationContext—Loads a context definition from one or
more XML files in the filesystem
XmlWebApplicationContext—Loads context definitions from one or more
XML files contained in a web application
10. //5.BEANS LIFE CYCLE
A bean’s life
Java’s new keyword is
used to instantiate the bean, and it’s ready to use. Once the bean is no longer in use,
it’s eligible for garbage collection and eventually goes to the big bit bucket in the sky.
Let’s break down figure 1.5 in more detail:
1 Spring instantiates the bean.
2 Spring injects values and bean references into the bean’s properties.
3 If the bean implements BeanNameAware, Spring passes the bean’s ID to the set-
BeanName() method.
4 If the bean implements BeanFactoryAware, Spring calls the setBeanFactory()
method, passing in the bean factory itself.
5 If the bean implements ApplicationContextAware, Spring calls the set-
ApplicationContext() method, passing in a reference to the enclosing application
context.
6 If the bean implements the BeanPostProcessor interface, Spring calls its post-
ProcessBeforeInitialization() method.
7 If the bean implements the InitializingBean interface, Spring calls its after-
PropertiesSet() method. Similarly, if the bean was declared with an initmethod,
then the specified initialization method is called.
8 If the bean implements BeanPostProcessor, Spring calls its postProcess-
AfterInitialization() method.
9 At this point, the bean is ready to be used by the application and remains in the
application context until the application context is destroyed.
10 .If the bean implements the DisposableBean interface, Spring calls its
destroy() method. Likewise, if the bean was declared with a destroy-method,
the specified method is called.
//6.SPRING REQUIRED LIB
As of Spring 4.0, there
are 20 distinct modules in the Spring
Framework distribution, with three JAR
files for each module
//7.SPRING ARCHITECHTURE
//8. SPRING 3.1 FEATURES
What was new in Spring 3.1?
Spring 3.1 had several useful new features and improvements, many of which were
focused on simplifying and improving configuration. In addition, Spring 3.1 provided
declarative caching support as well as many improvements to Spring MVC. Here’s a
brief list of some of the highlights of Spring 3.1:
To address the common issue of selecting distinct configurations for various
environments (such as development, test, and production), Spring 3.1 introduced
environment profiles. Profiles make it possible, for instance, to select a
different data source bean depending on which environment the application is
deployed in.
Building on Spring 3.0’s Java-based configuration, Spring 3.1 added several enable
annotations to switch on certain features of Spring with a single annotation.
Declarative caching support made its way into Spring, making it possible to
declare caching boundaries and rules with simple annotations, similar to how
you could already declare transaction boundaries.
A new c namespace brought constructor injection the same succinct attributeoriented
style as Spring 2.0’s p namespace brought to property injection.
Spring began to support Servlet 3.0, including the ability to declare servlets and
filters in Java-based configuration instead of web.xml.
Improvements to Spring’s JPA support made it possible to completely configure
JPA in Spring without needing a persistence.xml file.
Spring 3.1 also included several enhancements to Spring MVC:
Automatic binding of path variables to model attributes
@RequestMappingproduces and consumes attributes, for matching against a
request’s Accept and Content-Type headers
A @RequestPart annotation that enables binding parts of a multipart request to
handler method parameters
Support for flash attributes (attributes that survive a redirect) and a Redirect-
Attributes type to carry the flash attributes between requests
//9/SPRING 3.2 FEATURES
What was new in Spring 3.2?
Whereas Spring 3.1 was largely focused on configuration improvements with a small set
of other enhancements, including Spring MVC enhancements, Spring 3.2 was primarily
a Spring MVC-focused release. Spring MVC 3.2 boasted the following improvements:
Spring 3.2 controllers can take advantage of Servlet 3’s asynchronous requests
to spin off request processing in separate threads, freeing up the servlet thread
to process more requests.
Although Spring MVC controllers have been easily testable as POJOs since
Spring 2.5, Spring 3.2 included a Spring MVC test framework for writing richer
tests against controllers, asserting their behavior as controllers, but without a
servlet container.
In addition to improved controller testing, Spring 3.2 included support for
testing RestTemplate-based clients without sending requests to the real REST
endpoint.
An @ControllerAdvice annotation enables common @ExceptionHandler,
@InitBinder, and @ModelAttributes methods to be collected in a single class
and applied to all controllers.
Prior to Spring 3.2, full content negotiation support was only available via
ContentNegotiatingViewResolver. But in Spring 3.2, full content negotiation
became available throughout Spring MVC, even on controller methods relying
on message converters for content consumption and production.
Spring MVC 3.2 included a new @MatrixVariable annotation for binding a
request’s matrix variables to handler method parameters.
The abstract base class AbstractDispatcherServletInitializer can be used
for conveniently configuring DispatcherServlet without web.xml. Likewise, a
subclass named AbstractAnnotationConfigDispatcherServletInitializer
can be used when you wish to configure Spring with Java-based configuration.
The ResponseEntityExceptionHandler class was added to be used as an alternative
to DefaultHandlerExceptionResolver. ResponseEntityException-
Handler methods return ResponseEntity
RestTemplate and @RequestBody arguments support generic types.
RestTemplate and @RequestMapping methods support the HTTP PATCH
method.
Mapped interceptors support URL patterns to be excluded from interceptor
processing.
//10. SPRING 4.0 FEATURES
What’s new in Spring 4.0?
Spring 4.0 is the freshest release of Spring available. There are a lot of exciting new
features in Spring 4.0, including the following:
Spring now includes support for WebSocket programming, including support
for JSR-356: Java API for WebSocket.
Recognizing that WebSocket offers a low-level API, screaming for a higher-level
abstraction, Spring 4.0 includes a higher level message-oriented programming
model on top of WebSocket that’s based on SockJS and includes STOMP subprotocol
support.
A new messaging module with many types carried over from the Spring Integration
project. This messaging module supports Spring’s SockJS/STOMP support.
It also includes template-based support for publishing messages.
Spring 4.0 is one of the first (if not the first) Java frameworks to support Java 8
features, including lambdas. Among other things, this makes working with certain
callback interfaces (such as RowMapper with JdbcTemplate) much cleaner
and easier to read.
Along with Java 8 support comes support for JSR-310: Data and Time API, offering
the opportunity for developers to work with dates and times in a richer API
than that offered with java.util.Date or java.util.Calendar.
A smooth programming experience for applications developed in Groovy has
also been added, essentially enabling a Spring application to be developed easily
entirely in Groovy. With this comes the BeanBuilder from Grails, enabling
Spring applications to be configured with Groovy.
Generalized support for conditional bean creation has been added, wherein
beans can be declared to be created only if a developer-defined condition is
met.
Spring 4.0 also includes a new asynchronous implementation of Spring’s Rest-
Template that returns immediately but allows for callbacks once the operation
completes.
Support for many JEE specs has been added, including JMS 2.0, JTA 1.2, JPA 2.1,
and Bean Validation 1.1.
TODO
Caesars Casino Hotel, Las Vegas, NV | MapYRO
ReplyDeleteFind the best 양주 출장마사지 prices on Harrah's Casino Hotel 바카라 in Las 세종특별자치 출장샵 Vegas (NV). View real-time driving directions to the check-in 의정부 출장샵 and check-out times 전라남도 출장마사지 of rooms.