In this post under Spring SpEL, I will give a simple example that shows how to access bean properties and use literal values in SpEL expressions. SpEL (Spring Expression Language) is an expression language that supports querying and manipulating objects at runtime. This expression language is written within “${ and “}” when used inside annotation…… Continue reading SpEL Simple example
Category: Spring Framework
Spring @Value annotation
In this post under Spring Core, I will show with example how to use “@Value” annotation. In previous post I showed how to access system properties, environment properties, custom properties using “Environment” interface. In all these case we had to explicitly retrieve the value as shown below and are not injected into the bean automatically…… Continue reading Spring @Value annotation
Configuring access to multiple custom property files
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
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