Memorynotfound Java Programming Tutorials
Spring Lifecycle init-method and destroy-method
You can initialize or destroy your singleton bean using the xml configuration attributes init-method and destroy-method respectively. You must specify the name of the method that has a void no-argument signature. These methods will...
Gracefully Shutdown Spring Application Container
This tutorial shows you how to register a shutdown hook with the JVM in a non-web application context. By default the ApplicationContext does not have a shutdown hook and does not have any exposed...
Spring Custom Scope – Create and Implement ThreadScope
In spring you can use scopes like singleton or prototype. In my experience these scopes are sufficient for most application needs. But when you have specific requirements for creating your own custom scope, you...
Spring Bean Scopes – Singleton vs Prototype
When creating bean definitions you cannot only control various dependencies and configurations, but also define the scope of the bean. These scopes are configured via configuration which makes them very powerfull and flexible. You...
Lazy Initialize @Autowired Dependencies with @Lazy
By default all autowired dependencies are eagerly created and configured at startup. When the @Lazy annotation is present together with the @Component annotation on class level, then the component will not be eagerly created...
Lazy Initialize Spring Bean XML Configuration
By default spring container eagerly creates and configures all singleton beans. In most cases this is desirable, because errors and exceptions are discovered at startup time rather than runtime. When this behavior is not...
Spring Exclude Bean From Autowiring
This tutorial shows you how to exclude beans from autowiring. The <beans/> element has a autowire-candidate attribute which you can set to false to tell the container to make the bean unavailable for autowiring....
Spring Autowire beans with @Autowired Annotation
This tutorial shows how to use the @Autowired annotation. The @Autowired annotation marks a constructor, field, setter method or config methods as to be autowired for the spring container. Beans We are using these...
Spring Autowire By Constructor
This tutorial shows how to use spring autowire by constructor. When the autowire by constructor is enabled -which is actually analogous to autowire by type, but applies to constructor arguments- spring will autowire a...