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
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
https://stackoverflow.com/questions/27809838/how-to-instantiate-spring-managed-beans-at-runtime
https://stackoverflow.com/questions/27809838/how-to-instantiate-spring-managed-beans-at-runtime
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