Home > Web Front-end > JS Tutorial > body text

Spring configuration

php中世界最好的语言
Release: 2018-03-07 17:00:17
Original
1151 people have browsed it

This time I will bring you Spring configuration. What are the precautions for Spring configuration? The following is a practical case, let’s take a look.

Configuration fileName: 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>
Copy after login

I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to the php Chinese websiteOthersrelated articles!

Related reading:

Web.xml configuration

Spring’s MVC configuration

The above is the detailed content of Spring configuration. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!