Posts tagged "conditional"

Spring Conditional Bean Configuration: Load Beans Based on Custom Conditions

In a previous post, I made a small demo on how to load Java beans based on properties defined in a configuration file. While this is a very common scenario, sometimes you might need to create beans based on completely custom conditions. Once again, Spring provides an elegant solution for this: the @Conditional annotation. The… Continue reading

Spring Conditional Bean Configuration: Load Beans Based on Application Properties File

In complex applications, there are times when you will want the Spring dependency injector to create an instance of a class based on a given condition. One common case is to configure the bean definition based on a property defined in the application.properties file. By using this approach you can load custom beans at runtime… Continue reading