spring Conditional bean registration in Spring

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Remarks

Important point to note while using condition

  • The condition class is referred as direct class (not as spring bean) so it can't use the @Value property injection i.e. no other spring beans can be injected within it.
  • From java docs - Conditions must follow the same restrictions as BeanFactoryPostProcessor and take care to never interact with bean instances. The restrictions refereed here are A BeanFactoryPostProcessor may interact with and modify bean definitions, but never bean instances. Doing so may cause premature bean instantiation, violating the container and causing unintended side-effects.


Got any spring Question?