• 学习SPRING中的一个疑惑.请教一下各位


    <?xml version="1.0" encoding="utf-8" ?>
    <objects>
        <description>An  example that demonstrates simple IoC features.</description>
        <object name="MyMovieLister" type="Spring.Examples.MovieFinder.MovieLister, MovieFinder">
            <property name="movieFinder">
                <ref local="AnotherMovieFinder" />
            </property>
        </object>
        <object name="MyMovieFinder" type="Spring.Examples.MovieFinder.SimpleMovieFinder, MovieFinder"></object>
        <!--
        An IMovieFinder implementation that uses a text file as it's movie source...
        -->
        <object name="AnotherMovieFinder" type="Spring.Examples.MovieFinder.ColonDelimitedMovieFinder, MovieFinder">
            <constructor-arg index="0">
                <value>movies.txt</value>
            </constructor-arg>
        </object>
    </objects>

    这是Spring Quick中的程序.这里的Object AnotherMovieFinder定义一个构造函数.并将这个值设为movies.txt
    我的疑惑是.如果我需要在程序中把movies.txt改在test.txt的话.怎么实现呢?

    下面还有一个类似的问题.前面是构造函数.以下是一个属性.同样我需要在程序中去修改Message
     <object id="TheAction" type="MSPlus.ClassLibrary.UpperAction, MSPlus.ClassLibrary">
      <property name="Message">
       <value>MYFirst</value>
      </property>
     </object>
    并且我这里默认是Singleton模式.如果在程序中去修改Message的值后.再次从ObjectFactoy中获取对象时这个Message是显示的是Xml中默认定义的MYFirst值呢还是我在程序中修改后的新值?(我试了一下他还是会显示Xml中定义的值,但如何在Singleton模式下在以后获取这个对像时显示修改后的Message值的?)

    请大家请教一下...
  • 相关阅读:
    【CH 5501】环路运输【DP】【单调队列】
    【CH 5501】环路运输【DP】【单调队列】
    【POJ 1456】Supermarket【并查集】
    【POJ 1456】Supermarket【并查集】
    【POJ 1456】Supermarket【并查集】
    【POJ 2411】Mondriaan's Dream【DP】
    数据结构实验之二叉树二:遍历二叉树
    数据结构实验之二叉树二:遍历二叉树
    36 静态数据成员与静态成员函数
    36 静态数据成员与静态成员函数
  • 原文地址:https://www.cnblogs.com/mack/p/113325.html
Copyright © 2020-2023  润新知