In the previous example, all the Action components gotten from the S2ApplicationContext were the same instances.(singleton) If you want to obtain a new instance each time you get a component from s2app, please set :prototype symbol as an argument of the s2component method.
require 's2container' class Action s2comp :name => :act, :instance => :prototype end p s2app.get(:act) # p s2app[:act] # each time, new instance will be returned.
NOTE | |
---|---|
This Example is located at "examples/quickstart/quickstart3". |
© Copyright The Seasar Foundation and the others 2008-2009, all rights reserved. |