I want to create a Spring bean in Spring Java configuration with some constructor arguments passed at runtime. I have created the following Java config, in which there is a bean fixedLengthReport that expects some arguments in constructor.
@Configuration
public class AppConfig {
    @Autowrire
    Dao dao;
    @Bean
    @Scope(value = "prototype")
    **//SourceSystem can change at runtime**
    public FixedLengthReport fixedLengthReport(String sourceSystem) {
         return new TdctFixedLengthReport(sourceSystem, dao);
    }
}
But i am getting error that sourceSystem couldn't wire because no bean found. How can I create bean with runtime constructor arguments?
I am using Spring 4.2
 
     
     
     
     
     
    