Home Web Front-end JS Tutorial Spring configuration

Spring configuration

Mar 07, 2018 pm 05:00 PM
spring Configuration

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!

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

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

The working principle and configuration method of GDM in Linux system The working principle and configuration method of GDM in Linux system Mar 01, 2024 pm 06:36 PM

The working principle and configuration method of GDM in Linux system

The perfect combination of PyCharm and PyTorch: detailed installation and configuration steps The perfect combination of PyCharm and PyTorch: detailed installation and configuration steps Feb 21, 2024 pm 12:00 PM

The perfect combination of PyCharm and PyTorch: detailed installation and configuration steps

Use Spring Boot and Spring AI to build generative artificial intelligence applications Use Spring Boot and Spring AI to build generative artificial intelligence applications Apr 28, 2024 am 11:46 AM

Use Spring Boot and Spring AI to build generative artificial intelligence applications

Understand Linux Bashrc: functions, configuration and usage Understand Linux Bashrc: functions, configuration and usage Mar 20, 2024 pm 03:30 PM

Understand Linux Bashrc: functions, configuration and usage

MyBatis Generator configuration parameter interpretation and best practices MyBatis Generator configuration parameter interpretation and best practices Feb 23, 2024 am 09:51 AM

MyBatis Generator configuration parameter interpretation and best practices

How to configure workgroup in win11 system How to configure workgroup in win11 system Feb 22, 2024 pm 09:50 PM

How to configure workgroup in win11 system

Flask installation and configuration tutorial: a tool to easily build Python web applications Flask installation and configuration tutorial: a tool to easily build Python web applications Feb 20, 2024 pm 11:12 PM

Flask installation and configuration tutorial: a tool to easily build Python web applications

Application of JUnit unit testing framework in Spring projects Application of JUnit unit testing framework in Spring projects Apr 18, 2024 pm 04:54 PM

Application of JUnit unit testing framework in Spring projects

See all articles