Spring configuration
Mar 07, 2018 pm 05:00 PMThis 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>
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:
The above is the detailed content of Spring configuration. For more information, please follow other related articles on the PHP Chinese website!

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

The working principle and configuration method of GDM in Linux system

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

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

Understand Linux Bashrc: functions, configuration and usage

MyBatis Generator configuration parameter interpretation and best practices

How to configure workgroup in win11 system

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

Application of JUnit unit testing framework in Spring projects
