Autowiring by Name (Using @Qualifier with @Component annotation)

In previous post under Spring Core, I showed with example how to use “@Qualifier” annotation with “@Bean” annotation. In this post under Spring Core, I will show with example how to use “@Qualifier” annotation with “@Component” annotation. For our example I will create an interface named “IMovie” as shown below IMovie package core.package44; public interface…… Continue reading Autowiring by Name (Using @Qualifier with @Component annotation)

Using @Lookup annotation with arguments

In this post under Spring Core, I will explain with example how to use “@Lookup” annotation with arguments. In the previous post under Spring Core, I showed the purpose and how to use “@Lookup” annotation without any arguments. Just for recap,1) “@Lookup” annotation is applied on the method level2) It tells Spring to create a…… Continue reading Using @Lookup annotation with arguments

Using @Lookup annotation without arguments

In this post under Spring Core, I will explain with example the purpose of “@Lookup” annotation used without any arguments. “@Lookup” annotation is applied only on methods. “@Lookup” annotation can be used with or without arguments. In this post I will show how to use “@Lookup” annotation without arguments. In case of “@Lookup” annotation without…… Continue reading Using @Lookup annotation without arguments

Using @Conditional example

In this post under Spring Core, I will show with example the purpose of “@Conditional” annotation. Sometimes we want certain beans to be initialized based on a condition. If those conditions are not met we don’t want to initialize those beans. Say for example, we have two beans “bean1” and “bean2”. We want only “bean1″…… Continue reading Using @Conditional example

Internationalization in Spring

In this post under Spring Core, I will show with example how to achieve Internationalization using Spring framework. Internationalization in Spring is achieved using “MessageSource” interface and its default implementations. Whenever an “ApplicationContext” instance is created, Spring searches for bean definition with name “messageSource”, when found associate it with “ApplicationContext” instance. “ApplicationContext” interface implements “MessageSource”…… Continue reading Internationalization in Spring

Appling @Value on constructor parameter

In this post under Spring Core, I will show with example how to apply “@Value” annotation on a constructor parameter. In my previous post under Spring Core, I have showed how to apply “@Value” annotation on class instance variable. Below is the complete main class showing how to apply “@Value” annotation on a constructor parameter…… Continue reading Appling @Value on constructor parameter

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