Table of Contents
When the component is dependent on S2Container into which it is registered,
S2Container instance can be acquired by Property Injection.
The component name of S2Container is "container".
The following service classes are created as an example.
S2Container instance is be DI by automatic Property Injection.
module Example class Service s2comp def initialize @container = :container end attr_reader :container end end
An execution script is created as follows.
require 's2container' require 'example' service = s2app.get(Example::Service) p service.container.class.name
NOTE | |
---|---|
This Example is located in example/example12 |
© Copyright The Seasar Foundation and the others 2008-2009, all rights reserved. |