[Seasar-user:21359] Re: s2configでの環境による設定切り替えについて

Ryo Iwama [E-MAIL ADDRESS DELETED]
2012年 6月 28日 (木) 08:03:44 JST


海保様

happy_ryoです。
本件ですが、現象の再現・確認が出来たので
問題の箇所のアタリを付けて対応に入る段階なのですが
如何せんCore部分の変更になること、既存ユーザーへのインパクトが大きそうな事から
設定で既存の動作と切り替えられるようにするなど対応が必要になるため
対応に少しお時間いただく事になりそうです。

スナップショットを公開したら再度お知らせ致しますので
今しばらくお待ちいただければと思います。

2012年6月22日 17:53 Kaiho Hiroshi <Kaiho.Hiroshi @ exc.epson.co.jp>:
> 了解しました。
> よろしくお願いいたします。
>
> 海保
>
>> -----Original Message-----
>> From: seasar-user-bounces @ ml.seasar.org
>> [mailto:seasar-user-bounces @ ml.seasar.org] On Behalf Of Ryo Iwama
>> Sent: Friday, June 22, 2012 1:04 AM
>> To: seasar-user @ ml.seasar.org
>> Subject: [Seasar-user:21355] Re: s2configでの環境による設定切り替えについて
>>
>> 海保様
>>
>> happy_ryoです。
>> 本件ですが、立て込んでおり平日にまとまった時間がとれないため
>> 週末から来週頭にかけてでお返事できればと思っています。
>> 対応が遅くなってしまい申し訳ございませんがよろしくお願い致します。
>>
>>
>> 2012年6月12日 19:02 Kaiho Hiroshi <Kaiho.Hiroshi @ exc.epson.co.jp>:
>> > 海保と申します。
>> > 初めて投稿させていただきます。
>> > よろしくお願いいたします。
>> >
>> > http://ml.seasar.org/archives/seasar-user/2011-June/020807.html
>> > http://ml.seasar.org/archives/seasar-user/2011-June/020828.html
>> > http://ml.seasar.org/archives/seasar-user/2011-July/020844.html
>> >
>> > 上記のメーリングリストを参考に、env設定による環境切り替えを行おうとしており、
>> > その際に、期待した結果にならなかったので、内容のご確認と対応をご教示いただけれ
>> ばと思います。
>> >
>> > 下記のようなpropertiesファイルの設定をすると、
>> > hoge1とhoge2の項目はhoge_st.propertiesの値で上書き(fuga1, fuga2)され、
>> > hoge3はhoge.propertiesで設定した項目がそのまま利用(hoge3)され、
>> >
>> > 結果出力は、
>> > 「fuga1,fuga2,hoge3」
>> > を期待していたのですが、
>> >
>> > 実際には、
>> > 「fuga1,fuga2,デフォルト3」
>> > となります。
>> >
>> > --hoge.properties--
>> > env=st
>> > hoge1=hoge1
>> > hoge2=hoge2
>> > hoge3=hoge3
>> >
>> > --hoge_st.properties--
>> > hoge1=fuga1
>> > hoge2=fuga2
>> >
>> >
>> > s2configのユーザガイドを読んだなかでは、
>> > 「hoge_st.propertiesで定義されていない項目は上書きされない」
>> > つまり、
>> > 「hoge_st.proertiesに項目が無く、hoge.propertiesに項目があればその値、無ければ
>> デフォルト値」
>> > となるのが自然だと思うのですが、いかがでしょうか?
>> >
>> > ConfigContainerImpl#finadAllConfigValue()の中の
>> ConfigContainerTraversal#forEachParent()を見ると、
>> > 子コンテナ(hoge_st.propertiesの値を保持している)から順にpropertiesファイルの値
>> を見ており、
>> > この際に子コンテナに存在しないキーの場合はデフォルト値を返すようになっているようで
>> す。
>> >
>> > よろしくお願いいたします。
>> >
>> >
>> > 【環境】
>> > s2-frameworkのバージョン      2.4.42
>> > s2-extensionのバージョン 2.4.42
>> > s2config-coreのバージョン 1.0.3
>> >
>> > 【設定ファイル】
>> > --configCustomize.dicon--
>> >
>> > <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE components PUBLIC
>> > "-//SEASAR//DTD S2Container 2.4//EN"
>> >    "http://www.seasar.org/dtd/components24.dtd">
>> > <components>
>> >    <!-- コンフィグの読み書きの実装を指定します -->
>> >    <component
>> > class="org.seasar.config.core.config.impl.ConfigPropertiesWriter"
>> > instance="prototype"/>
>> >    <component
>> > class="org.seasar.config.core.config.impl.ConfigPropertiesReader"
>> > instance="prototype"/>
>> > </components>
>> >
>> > --config.dicon―
>> >
>> > <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE components PUBLIC
>> > "-//SEASAR//DTD S2Container 2.4//EN"
>> >    "http://www.seasar.org/dtd/components24.dtd">
>> > <components>
>> >    <include path="s2config-core.dicon"/>
>> >    <component
>> >        name="configContainer"
>> > class="org.seasar.config.core.container.impl.StrictConfigContainer">
>> >        <arg><component
>> > class="org.seasar.config.core.container.impl.ConfigContainerImpl"
>> > autoBinding="none"/></arg>
>> >        <property name="configName">"hoge"</property>
>> >    </component>
>> > </components>
>> >
>> > --hoge.dicon―
>> >
>> > <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE components PUBLIC
>> > "-//SEASAR//DTD S2Container 2.4//EN"
>> >    "http://www.seasar.org/dtd/components24.dtd">
>> > <components>
>> >    <include path="config.dicon"/>
>> >    <component class="jp.sample.Hoge">
>> >
>> > <arg>configContainer.findAllConfigValue(@java.lang.String @ class,
>> > "hoge1, "デフォルト1")</arg>
>> > <arg>configContainer.findAllConfigValue(@java.lang.String @ class,
>> > "hoge2,
>> > "デフォルト2")</arg>
>> >
>> > <arg>configContainer.findAllConfigValue(@java.lang.String @ class,
>> > "hoge3, "デフォルト3")</arg>
>> >    </component>
>> > </components>
>> >
>> > --Hogeクラス―
>> >
>> > public class Hoge {
>> >
>> >    /**
>> >     * コンストラクタ
>> >     */
>> >    public Hoge(String h1, String h2, String h3) {
>> >        System.out.println(h1 + “,” + h2 + “,” + h3);
>> >    }
>> > }
>> >
>> >
>> >
>> > _______________________________________________
>> > Seasar-user mailing list
>> > Seasar-user @ ml.seasar.org
>> > https://ml.seasar.org/mailman/listinfo/seasar-user
>> >
>>
>>
>>
>> --
>> //////////////////////////////////////////////////////////////////////////////////////////////////////////
>>
>> 岩間 亮 <Ryo Iwama>
>> (id:happy_ryo)
>>
>> blog:http://d.hatena.ne.jp/happy_ryo/
>>
>> 参加プロジェクト
>>
>> NetBeans日本語コミュニティ:http://wiki.netbeans.org/JaNetBeans
>> S2Config(設定情報管理):http://s2config.sandbox.seasar.org/
>> Fisshplate(Excelテンプレート):http://fisshplate.sandbox.seasar.org/
>>
>> しごと
>>
>> CHOT
>> http://chot.to
>>
>> ピーチク
>> http://ptic.jp
>> //////////////////////////////////////////////////////////////////////////////////////////////////////////
>> _______________________________________________
>> Seasar-user mailing list
>> Seasar-user @ ml.seasar.org
>> https://ml.seasar.org/mailman/listinfo/seasar-user
> _______________________________________________
> Seasar-user mailing list
> Seasar-user @ ml.seasar.org
> https://ml.seasar.org/mailman/listinfo/seasar-user



-- 
//////////////////////////////////////////////////////////////////////////////////////////////////////////

岩間 亮 <Ryo Iwama>
(id:happy_ryo)

blog:http://d.hatena.ne.jp/happy_ryo/

参加プロジェクト

NetBeans日本語コミュニティ:http://wiki.netbeans.org/JaNetBeans
S2Config(設定情報管理):http://s2config.sandbox.seasar.org/
Fisshplate(Excelテンプレート):http://fisshplate.sandbox.seasar.org/

しごと

CHOT
http://chot.to

ピーチク
http://ptic.jp
//////////////////////////////////////////////////////////////////////////////////////////////////////////


Seasar-user メーリングリストの案内