[Seasar-user:15599] 【S2Container】logicクラスでtraceInterceptorが動かない
    黒川博之
    [E-MAIL ADDRESS DELETED]
       
    2008年 9月  2日 (火) 09:04:12 JST
    
    
  
黒川と申します。
diconに以下のように定義したlogicクラスのメソッドが実行はされますが
traceInterceptorが動かず、ログが出力されません。
Hogeを例として使うと、以下のようなイメージです。
【クラス】(全て同一パッケージ:example.logic.hoge)
public abstract class AbstractHogeLogic {
    public String name;
    public abstract void show();
}
public class HogeAaaLogic extends AbstractHogeLogic {
    public void show() {
        System.out.println("ほげAです。");
    }
}
public calss HogeBbbLogic extends AbstractHogeLogic {
    public void show() {
        System.out.println("ほげBです。");
    }
}
【hoge.dicon】(app.diconでincludeしています)
<component name="hogeLogicItems" class="java.util.ArrayList">
    <initMethod name="add">
        <arg>
            <component name="hoge_hogeAaaLogic" 
class="example.logic.hoge.HogeAaaLogic">
                <property name="name">"ほげAaa"</property>
            </component>
        </arg>
    </initMethod>
    <initMethod name="add">
        <arg>
            <component name="hoge_hogeBbbLogic" 
class="example.logic.hoge.HogeBbbLogic">
                <property name="name">"ほげBbb"</property>
            </component>
        </arg>
    </initMethod>
</component>
【sastrutsのindex()】
public class HogeAction {
    @Resource
    protected List<AbstractHogeLogic> hogeLogicItems = new 
ArrayList<AbstractHogeLogic>();
    @Execute(validator = false)
    public String index() {
        for (int i = 0; i < hogeLogicItems.size(); i++) {
            AbstractHogeLogic hogeLogic = hogeLogicItems.get(i);
            hogeLogic.show();
        }
        return "index.jsp";
    }
}
なお、creator.diconとcustomizer.diconは以下のようになっており
上記のように、diconに記述していないlogicクラスは、メソッド実行時に
ログが出力されています。
【creator.dicon】
<component class="org.seasar.framework.container.creator.LogicCreator"/>
【customizer.dicon】
<component name="logicCustomizer" 
class="org.seasar.framework.container.customizer.CustomizerChain">
    <initMethod name="addCustomizer">
        <arg>traceCustomizer</arg>
    </initMethod>
</component>
hoge.diconで定義したhogeLogicItemsには、creator.dicon/customizer.diconでインターセプターを設定しても
インターセプターは適用されないのでしょうか?
また、インターセプターを適用させるためにはhoge.diconにどのように記述すればいいのでしょうか?
よろしくお願いします。 
    
    
Seasar-user メーリングリストの案内