日期:2014-05-18  浏览次数:20738 次

请详细解释以下配置文件中的意思?包括方括号里面的信息?
applicationContext.xml   :

<bean   id= "sessionFactory "
class= "org.springframework.orm.hibernate3.LocalSessionFactoryBean ">
<property   name= "dataSource ">
<ref   local= "dataSource "   />
</property>
<property   name= "mappingResources ">
<list>
<value> cn/holleygrid/mis/bo/Operator.hbm.xml </value>
</list>
</property>
<property   name= "hibernateProperties ">
<props>
<prop   key= "hibernate.dialect ">
org.hibernate.dialect.Oracle9Dialect
</prop>
<prop   key= "hibernate.show_sql "> true </prop>
</props>
</property>
</bean>


<bean   id= "baseDao "   class= "cn.holleygrid.mis.dao.hibernate.BaseHibernateDao ">
<property   name= "sessionFactory ">
<ref   local= "sessionFactory "   />
</property>
</bean>


struts-config.xml   :

    <global-exceptions/>

    <global-forwards   >
       
    </global-forwards>


    <controller   processorClass= "cn.holleygrid.mis.util.uRequestProcessor "/>
    <message-resources   parameter= "cn.holleygrid.mis.ApplicationResources "/>

    <plug-in   className= "org.springframework.web.struts.ContextLoaderPlugIn ">
        <set-property   property= "contextConfigLocation "   value= "/WEB-INF/applicationContext.xml "/>  
    </plug-in>

每个方括号里面,属性的含义(如: <ref   local= "dataSource "   /> ),我的基础很差,很感谢各位朋友能帮我详细的回答!!!非常的感谢!!!

------解决方案--------------------
<bean id= "sessionFactory "
class= "org.springframework.orm.hibernate3.LocalSessionFactoryBean ">
<property name= "dataSource ">
<ref local= "dataSource " />
</property>
这是spring的配置管理xml文件,一些bean的依赖注入都是在此定义的
引用LocalSessionFactoryBean这个类,将其标记为sessionFactory,并引用id为dataSource的bean标记,注入到LocalSessionFactoryBean的dataSource的属性中

<ref local= "dataSource " />
首先说,你的代码没有贴完整,也就是bean的id指定为dataSource的一个bean标记,在此是个引用!

建议楼主去看看spring的入门书!spring技术手册或是spring 核心应用
------解决方案--------------------
最好系统的看下书。
------解决方案--------------------
自己看书吧,这东西书上都有。这样告诉你了你该不会还是不会,而且这样跟你讲不可能象书上那样讲的那么详细
------解决方案--------------------
要看书 这样才会知道的更加详细啊
------解决方案--------------------
用google搜spring就知道结果了
------解决方案--------------------
HTML code

<bean   id="sessionFactory" 
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean" > //表示Id是sessionFactory的一个bean,路径是org.springframework.orm.hibernate3.LocalSessionFactoryBean"
<property   name="dataSource" > //该bean的有个属性是dataSource
<ref   local="dataSource"   / > //给这个bean的dataSource属性注入此配置文件中id为dataSource的bean,一下类似
</property > 
<proper