简体   繁体   中英

Spring session-scoped bean with construtor argument

In Spring I have bean that should not be instantiated without a constructor argument which depend on user input. what is the correct way to instantiate the SessionScoped bean in a controller or another Singleton-Scopped bean ?

public class SingletonScoped{
    ...
}

public class SessionScoped{
    @Autowired
        SingletonScoped singletonScopped;

    private SessionScoped(){
    }

    public SessionScoped(Object userInput){

    }

}

 public class AnotherSingletonScoped{
    ...
}

basically i should add spring argument in serverlet-context.xml then u can passing argument here. A more detail u can see in this post http://chiase.azurewebsites.net/?p=171

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM