Category: Spring Core
Spring Caching Example with Java and XML Configuration
Spring Caching Annotations In this tutorial we show you how you can leverage the spring framework caching abstraction to improve the performance of your system. At its core, the abstraction applies caching to Java...
Spring Profiles Java and XML Configuration
In an enterprise application, you can have different configurations for different environments. For example, maybe in development you are developing against an in-memory datasource rather than looking up that same datasource from JNDI in...
Mixing XML and Java Config in Spring
In an enterprise application, you’ll probably have multiple configuration files to structure your application. Using spring, these configuration files can vary from XML to Java Configuration. This tutorial shows you how to import an...
Spring Filter Components From Component Scanning
When using auto component scanning, only the special marker interfaces and annotations that itself are annotated with @Component are eligible. We can modify and/or extend this behavior by applying custom filters. We can use...
Automatically Discover Beans with Auto Component Scanning
You can define your spring beans manually or let spring automatically discover stereotyped classes and register corresponding bean definitions with the application context. Spring scans for special marker annotations, which allows spring to auto-detect...
Creating and Configuring Custom @Qualifier Annotation
When Handling Multiple Dependencies with @Primary or Handling Multiple Dependencies with @Qualifier are not sufficient or you want to create your own custom @Qualifier Annotations for some reason. Spring allows you to create your...
Handling Multiple Autowire Candidates with Spring @Qualifier
Handling multiple autowire candidates with @Primary is effective when only one primary candidate can be determined for multiple autowire candidates. When you need more control over the selection process, you can use spring @Qualifier...
Handling Multiple Autowire Candidates with Spring @Primary
In spring, dependency injection is done default by type, this means that when there are multiple dependencies with the same type a NoUniqueBeanDefinitionException exception will be thrown. Indicating that only one candidate can be...
Spring Lifecycle Default Initialization and Destroy Methods
When working on a project with many team members, it is good to have some conventions. One of this conventions could be that you agree to use the same method name for initialization and...