Spring Framework provides Spring Factory Method mechanics to create Beans from static(non-static) method of a Factory Class in XML config files. In the tutorial, JavaSampleApproach will introduce Spring Factory Method with sample codes.
Spring Framework new release 4.3 make some Web Improvements. Among that, it simplifies way to implement Bean Scopes (Request, Session and Application scopes) using Annotation: @RequestScope | @SessionScope | @ApplicationScope. They are only valid in the context of a web-aware Application.
Spring Expression Language (SpEL) is a powerful expression language that supports querying and manipulating an object graph at runtime.
This tutorial shows various examples of ways to use SpEL expressions with XML and annotation based configuration. We also know how to evaluate an expression using SpEL classes and interfaces.
@Resource Annotation is used to indicate a reference to a resource, it is considered an alternative to @Autowired which is an Spring standard. Similar to Java EE 5, we can use @Resource Annotation with field injection or setter method.
This tutorial will cover those kinds of injection which will be used for matching by Name, Type or Qualifier.
Callable is a Java interface that is an useful methodology for control multi-threading returns on concurrency development.
The tutorial will guide you to build a concurrency program with ThreadPoolTaskExecutor of Spring Framework and Callable interface.
In application development, sometimes we should make different configuration for each environment. Spring Profiles provides a way to separate application configuration into some parts and they are only available in one or more specific environments.
This tutorial introduces ways to use Spring Profiles by @Profile Annotation or XML Configuration.
@Value Annotations vs Environment vs @ConfigurationProperties.
This tutorial helps you have a comparison view covering those solutions.
We can load properties value from Properties file to Spring Environment just by using @PropertySource annotation. This tutorial shows you the simple way to get them from Environment object.
– Inject Properties from Properties File using @Value annotation
– Inject Properties from Properties File using @ConfigurationProperties Annotation
– How to use Spring Factory Method to create Spring Bean
This tutorial will show you the better way to handle properties using @ConfigurationProperties Annotation.
In previous article, we have learned about using @Value annotation to inject properties from properties file. This approach has disadvantage that if we wanna change any property, we have to update all files which referenced it.
This tutorial shows you the way to inject Properties from Properties File using @Value Annotation with Java Configuration and @PropertySource.
You will also know how to use SourcesPlaceHolder and ConversionService for specific cases including: List/Arrays, special types (DateTime, Pattern), when a value that should be treated as null or a placeholder fails to resolve.
annotation-config and component-scan are important basic concepts of Spring Core.
This tutorial helps you understand how to use them and difference between them.
Spring based configuration using Annotation help you to create Spring configurations without XML.
This tutorial give you an example with most of Spring Annotation for configuration: @Configuration, @Bean (with custom bean lifecycle method), @Import, @Scope. And they’re in multi-configuration context.
At the Core of Spring Framework, Spring IoC (Inversion of Control) is implemented using the Dependency Injection design pattern. The Spring IoC Container creates, configures and connects the objects (which are called Beans), then manage their life cycle.
This tutorial introduce principle of Spring IoC and a simple example using Containers to you.
The BeanPostProcessor interface helps us provide our own methods before the initialization of beans and likewise after the initialization of the bean.
BeanPostProcessor are common for all beans in the container where it is defined, so it is different from @PostConstruct, InitializingBean and custom init method which are defined on the bean itself.
Related Article: Spring Bean Life Cycle
Spring Bean Life Cycle is very important because in many applications, we want to create some operations before initializing a Bean or make some operations before bean’s destruction.
This tutorial introduce four ways to control life cycle events of a Bean.
The tutorial shows you the way to implement Bean Scopes (Singleton, Prototype, Request and Session) using Annotation @Scope. Except Singleton and Prototype Scope, the others are only valid in the context of a web-aware Application.
Related Article: Spring Bean Scope – Singleton and Prototype