ホームページ  >  記事  >  ウェブフロントエンド  >  スプリング構成

スプリング構成

php中世界最好的语言
php中世界最好的语言オリジナル
2018-03-07 17:00:171104ブラウズ

今回は Spring 構成について説明します。 Spring 構成の 注意事項 は何ですか? 実際のケースを見てみましょう。

設定ファイル名前: applicationContext.xml

<?xml version="1.0" encoding="UTF-8"?><beans
    xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:p="http://www.springframework.org/schema/p"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
    <!-- Spring整合Hibernate -->
    <bean id="sessionFactory"
        class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
        <property name="configLocation"
            value="classpath:hibernate.cfg.xml">
        </property>
    </bean>
    <bean id="userDao" class="com.troyforever.example.mvc.dao.UserImpl">
        <property name="sessionFactory" ref="sessionFactory"></property>
    </bean>
    <!-- 分页 -->
    <bean id="pageDao" class="com.troyforever.example.mvc.dao.PageDao">
        <property name="sessionFactory" ref="sessionFactory"></property>
    </bean>
    
    <bean id="contactDao" class="com.troyforever.example.mvc.dao.ContactImpl">
        <property name="sessionFactory" ref="sessionFactory"></property>
        <property name="pageDao" ref="pageDao"></property>
    </bean></beans>

この記事の事例を読んだ後は、この方法を習得したと思います。さらにエキサイティングな内容については、php 中国語 Web サイトその他関連記事に注目してください。

関連書籍:

web.xmlの設定

SpringのMVC設定

以上がスプリング構成の詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。

声明:
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。
前の記事:web.xmlの設定次の記事:web.xmlの設定