Spring Framework. Reference Documentation .. Shutting down the Spring IoC container gracefully in non-web applications ApplicationContextAware. Reference Documentation ii. Table of Contents . New Features and Enhancements in Spring Framework Subclassing for PDF views. Copyright © Copies of this document may be made for your own use and for distribution to others, provided that you do not charge any fee Implementing DAOs based on plain Hibernate 3 API. Subclassing for PDF views.
|Language:||English, Spanish, Portuguese|
|Distribution:||Free* [*Sign up for free]|
Spring Framework Reference Documentation Copies of this document may be made for your own use and for distribution to others, provided that you do not charge any fee Spring MVC 3 Validation. Subclassing for PDF views. Using depends-on; Lazy-initialized beans; Autowiring collaborators .. Document views (PDF/Excel) This part of the reference documentation covers all of those technologies that are absolutely integral to the Spring. Spring Framework Reference Documentation 2. New Features and Enhancements in Spring Framework · .. Document views (PDF/ Excel).
What content types your API supports? What is the structure of the response?
How to test your API? What kind of security mechanism you use?
REST gives you the flexibility to choose your documentation format and approach. You need to document your API. One option is to maintain documentation manually. But that gets outdated quickly. Other option is to generate documentation from code.
The wiring can be done through any method, as illustrated here: Autowired private TreasureMap treasureMap; To resolve any autowiring ambiguity, use the Qualifier attribute with Autowired. Stereotyping Annotations These annotations are used to stereotype classes with regard to the application tier that they belong to. Repository Type Stereotypes a component as a repository. Service Type Stereotypes a component as a service. Automatically Configuring Beans In the previous section, you saw how to automatically wire a bean's properties using the Autowired annotation.
To get started with automatic registration of beans, first annotate the bean with one of the stereotype annotations, such as Component: You can specify a name for the bean by passing it as the value of Component. For example: Use a conventions-based view resolver. Section 3. For defining aspects, Spring leverages the set of annotations provided by AspectJ.
After Method Declares a method to be called after a pointcut completes.
AfterReturning Method Declares a method to be called after a pointcut returns successfully. AfterThrowing Method Declares a method to be called after a pointcut throws an exception. Around Method Declares a method that will wrap the pointcut.
Before Method Declares a method to be called before proceeding to the pointcut. DeclareParents Static Field Declares that matching types should be given new parents,that is, it introduces new functionality into matching types.
Pointcut Method Declares an empty method as a pointcut placeholder method.
Then you can annotate bean classes to be aspects: Section 4. Annotation Use Description PostConstruct Method Indicates a method to be invoked after a bean has been created and dependency injection is complete. Used to perform any initialization work necessary. PreDestroy Method Indicates a method to be invoked just before a bean is removed from the Spring context.
Used to perform any cleanup work necessary. Resource Method, Field Indicates that a method or field should be injected with a named resource by default, another bean.
If you'd rather explicitly choose another bean to wire into the property, specify it to the name attribute: For example, consider the following methods added to the Pirate class: Section 5. Annotation Use Description AfterTransaction Method Used to identify a method to be invoked after a transaction has completed.
BeforeTransaction Method Used to identify a method to be invoked before a transaction starts.
ContextConfiguration Type Configures a Spring application context for a test. DirtiesContext Method Indicates that a method dirties the Spring container and thus it must be rebuilt after the test completes. ExpectedException Method Indicates that the test method is expected to throw a specific exception. The test will fail if the exception is not thrown.
IfProfileValue Type, Method Indicates that the test class or method is enabled for a specific profile configuration. NotTransactional Method Indicates that a test method must not execute in a transactional context. The absence of this annotation will cause profile values to be loaded from system properties. Repeat Method Indicates that the test method must be repeated a specific number of times. Rollback Method Specifies whether or not the transaction for the annotated method should be rolled back or not.
TestExecutionListeners Type Identifies zero or more test execution listeners for a test class. Timed Method Specifies a time limit for the test method. If the test does not complete before the time has expired, the test will fail.
If you'd rather specify one or more XML files to load the application context from, you can do that with ContextConfiguration: Accessing the Spring Context in a Test If you need the Spring application context itself in a test, you can autowire it into the test the same as if it were a bean in the context: Like This Refcard?
Let's be friends: Declares a constructor, field, setter method, or configuration method to be autowired by type. Defines ordering, as an alternative to implementing the org.
Only missing point is that this book only covers Spring MVC and web flow and does not cover whole Spring framework. Also, in my opinion, their chapter on Spring Fundamentals is one of the best ways to start with Spring framework.
This book is a collection of Spring recipes or How to do in Spring Framework. In every Spring recipes, you learn some new concept and it also helps to learn Spring fundamental e. This books also provide excellent coverage of many spring technologies e.
If you like books on problem solution approach then you will enjoy reading Spring Recipes, not the best book on Spring but still a good one and will definitely make any list of top 10 books on Spring framework. ProfessionalJava Development with the Spring Framework The main highlight of this book is that one of its authors is Rod Johnson , who has also created Spring framework.
So you get his view on Spring and How spring should be used, what are best practices to follow on Spring e. When to use Setter Injection and Constructor Injection. Also examples in this book is easy to understand and it also focus on Unit tests which are good practice. If you are looking an overview on Spring features, then Spring Documentation is the best book to read.