Thursday, January 28, 2021

Bean Create Dynamically in Spring with Params ?

package org.springframework.beans.factory.config;
public interface BeanDefinition extends AttributeAccessor, BeanMetadataElement {
	String SCOPE_SINGLETON = ConfigurableBeanFactory.SCOPE_SINGLETON;
	String SCOPE_PROTOTYPE = ConfigurableBeanFactory.SCOPE_PROTOTYPE;
}

Beans can be "prototype" - Bean generated afresh at each call
or It can be "singleton" - One Bean for all Calls




How to pass parameters dynamically to Spring beans @Bean
@Configuration
public class ApplicationConfiguration {
  @Bean
  @Scope("prototype") //As we want to create several beans with different args, right?


No comments:

Post a Comment

Azure - Pipeline - Add Approver for Stage

https://learn.microsoft.com/en-us/azure/devops/pipelines/process/approvals?view=azure-devops&tabs=check-pass