In this post under Spring Core, I will show with example how to configure access to multiple custom property files. In the previous post, I showed with example how to configure access to single custom property file. In real world scenario they wouldn’t be a situation where we need access to only one custom property…… Continue reading Configuring access to multiple custom property files
Category: Spring Framework
Configuring access to custom property file
In this post under Spring Core, I will show with example how to configure access to custom property file. In the last blog I showed with example how to access system and environment properties. But those are not the only properties that we need access to. We developers also need access to properties created by…… Continue reading Configuring access to custom property file
Accessing system and environment properties
In this post under Spring Core, I will explain with example how to access system and environment properties. To read system and environment properties we take help of Spring’s “Environment” interface. The approaches to access system and environment properties are different but the “Environment” interface hides that implementation detail and provides a single interface through…… Continue reading Accessing system and environment properties
Ordering Application Event listener
In my previous post under Spring Core, I showed you guys, how to listed to application events, how to create and publish our own application event, and how to associate multiple event listeners to one particular event. In this post under Spring Core, I will show with example how to order multiple application event listener…… Continue reading Ordering Application Event listener
Chaining multiple application event listener
In previous post under Spring Core, I showed1) how to listen for events generated from application context2) how to generate and listen for custom application event. In this post, I will show with example how to chain multiple event listener for a particular application event For our example, I will take “ContextStoppedEvent” event which is…… Continue reading Chaining multiple application event listener
Generating Custom application events
In this post under Spring Core, I will show with example how to create custom application events. For our example, I created a custom event that the application will generate as shown below CustomEvent package package32; import org.springframework.context.ApplicationEvent; public class CustomEvent extends ApplicationEvent { public CustomEvent(Object source) { super(source); } } In the above code,…… Continue reading Generating Custom application events
Listening to ApplicationContext events
In this post under Spring Core, I will explain with example how to listen to ApplicationContext events. The Spring framework when creates/stops/refresh an ApplicationContext, it generates certain events and we as a developer can listen to those events and add our custom logic so that it can be executed. For our example, I will create…… Continue reading Listening to ApplicationContext events
Using filters to customize @ComponentScan annotation
In one of my previous posts under Spring Core, I explained the purpose of “@ComponentScan” annotation with example. For recap, “@ComponentScan” annotation when applied at the class level with an package name as an argument tells Spring framework to scan for class files annotated with “@Component” annotationunder the specified package folder. It scans the subfolders…… Continue reading Using filters to customize @ComponentScan annotation
Autowiring interface with multiple implementation
Autowiring interface with multiple implementation In this post, I will explain with example how to inject a bean whose type is an interface (Java Interface or Abstract class) and it has multiple classes that implements it. In the previous post, I showed how Spring Framework inject a bean whose type is an interface and has…… Continue reading Autowiring interface with multiple implementation
Autowiring interface with single implementation
In all my previous posts under Spring Core, I showed how to inject a bean belonging to a particular class. But in reality, to maintain a loose coupling we program to an interface and not to a class. (Interface doesn’t represent Java Interface. Here Interface is generic term that represents either Java Interfaceor Java Abstract…… Continue reading Autowiring interface with single implementation