Application.xml configuration in SSH

Source: Internet
Author: User


About MySQL's jdbc.properties
1 jdbc.driverclassname=com.mysql.jdbc.Driver2 jdbc.url=jdbc:mysql://  Localhost:3306/ue_project3 jdbc.username=root4 jdbc.password=huashow
 application.xml configuration in SSH

1<?xml version= "1.0" encoding= "UTF-8"?>2<beans xmlns= "Http://www.springframework.org/schema/beans"3xmlns:context= "Http://www.springframework.org/schema/context"4Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"5xmlns:aop= "HTTP://WWW.SPRINGFRAMEWORK.ORG/SCHEMA/AOP"6Xmlns:util= "Http://www.springframework.org/schema/util"7xmlns:tx= "Http://www.springframework.org/schema/tx"8Xsi:schemalocation= "9http//Www.springframework.org/schema/contextTenhttp//www.springframework.org/schema/context/spring-context.xsd Onehttp//Www.springframework.org/schema/beans Ahttp//www.springframework.org/schema/beans/spring-beans.xsd -http//WWW.SPRINGFRAMEWORK.ORG/SCHEMA/AOP -http//www.springframework.org/schema/aop/spring-aop.xsd thehttp//Www.springframework.org/schema/util -http//www.springframework.org/schema/util/spring-util.xsd -http//Www.springframework.org/schema/tx -http//www.springframework.org/schema/tx/spring-tx.xsd +"> - <!--read the jdbc.properties configuration file -- +<beanclass= "Org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" > A<property name= "Locations" value= "Classpath:jdbc.properties"/> at</bean> - <!--configuring datasource for JDBC -<bean id= "DataSource"class= "Org.apache.commons.dbcp.BasicDataSource" > -<property name= "Driverclassname" value= "${jdbc.driverclassname}"/> -<property name= "url" value= "${jdbc.url}" ></property> -<property name= "username" value= "${jdbc.username}" ></property> in<property name= "Password" value= "${jdbc.password}" ></property> -</bean> to<bean id= "Sessionfactory"class= "Org.springframework.orm.hibernate5.LocalSessionFactoryBean" > +<property name= "DataSource"ref= "DataSource"/> -<property name= "Mappingresources" > the<list> *<value>/com/hnqy/entity/Admin.hbm.xml</value> $<value>/com/hnqy/entity/Figure.hbm.xml</value>Panax Notoginseng<value>/com/hnqy/entity/Goodsdetail.hbm.xml</value> -<value>/com/hnqy/entity/Ordermanager.hbm.xml</value> -</list> About</property> $<property name= "Hibernateproperties" > -<value> - hibernate.dialect=org.hibernate.dialect.MySQLDialect - hibernate.show_sql=true A hibernate.format_sql=true +</value> the</property> -</bean> $ <!--define the bean where the hiberntatetemplate is located-- the<bean name= "Hibernatetemplate"class= "Org.springframework.orm.hibernate5.HibernateTemplate" > the<property name= "Sessionfactory" ref= "Sessionfactory" ></property> the</bean> the <!--define the bean where the transaction is located-- -<bean id= "TransactionManager"class= "Org.springframework.orm.hibernate5.HibernateTransactionManager" > in<property name= "Sessionfactory" ref= "Sessionfactory" ></property> the</bean> the <!--Define the properties of a transaction-- About<tx:advice id= "Txadvice" transaction-manager= "TransactionManager" > the<tx:attributes> the <!--read-only= "true" transaction isolation level is lowest and performance is highest the<tx:method name= "list*" read-only= "true"/> +<tx:method name= "find*" read-only= "true"/> -<tx:method name= "get*" read-only= "true"/> the <!--In addition to the methods defined above, all other methods are handled by transaction --Bayi<tx:method name= "*"/> the</tx:attributes> the</tx:advice> - <!--Define the entry points used by the firm-- -<aop:config> the<aop:pointcut expression= "Execution (* com.hnqy.service.impl.*.* (..))" id= "Pointcut"/> the<aop:advisor advice-ref= "Txadvice" pointcut-ref= "Pointcut"/> the</aop:config> the <!--import ssh to create a bean file-- -<ImportResource= "Bean.xml"/> the</beans>

(Included with the web. config)
1<?xml version= "1.0" encoding= "UTF-8"?>2<web-app xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xmlns= "Http://java.sun.com/xml/ns/javaee" xsi: schemalocation= "Http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id= "Webapp_ ID "version=" 3.0 ">3<display-name>store</display-name>4<welcome-file-list>5<welcome-file>index.html</welcome-file>6<welcome-file>index.htm</welcome-file>7<welcome-file>index.jsp</welcome-file>8  9</welcome-file-list>Ten  <!--filter filter to control the session open in view, close the filter that must be placed on struts- - One<filter> A<filter-name>OpenSessionInViewFilter</filter-name> -<filter-class>org.springframework.orm.hibernate5.support.opensessioninviewfilter</filter-class> -</filter> the<filter-mapping> -<filter-name>OpenSessionInViewFilter</filter-name> -<url-pattern>/*</url-pattern> - </filter-mapping> +      - <!--Configure the core filter for struts-- + <filter> A <filter-name>struts2</filter-name> at <filter-class>org.apache.struts2.dispatcher.filter.strutsprepareandexecutefilter</filter-class > - </filter> - <filter-mapping> - <filter-name>struts2</filter-name> <url-pattern>*.action</url-pattern>< c10>28 </filter-mapping> in <!--app starts loading spring configuration file Specify the profile location -- - <context-param> <param-name>contextConfigLocation</param-name> lt;param-value>classpath:beans.xml</param-value> </context-param> the <!--Configure Spring's listener-- * <listener> <listener-class>org.springframework.web.context.contextloaderlistener </listener-class>Panax Notoginseng </listener> -</web-app>

Application.xml configuration in SSH

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.