Struts2.3+Spring3.2.8+Hibernate4.1全注解配置

帮朋友搭建个简单的helloworld的平台,较简单,,但是能用了。

给ssh的“零配置”一个正解。看我这个就够了ok了!

jdbc.driver=com.mysql.jdbc.Driverjdbc.url=jdbc:mysql://localhost:3306/sshfw?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=roundjdbc.username=rootjdbc.password=leizm

log4j.rootLogger=debug, stdoutlog4j.logger.java.sql.Connection=info, stdoutlog4j.logger.java.sql.Statement=debug, stdoutlog4j.logger.java.sql.PreparedStatement=debug, stdoutlog4j.logger.org.hibernate=errorlog4j.logger.org.hibernate.SQL=debuglog4j.logger.org.hibernate.tool.hbm2ddl=debuglog4j.appender.stdout=org.apache.log4j.ConsoleAppenderlog4j.appender.stdout.layout=org.apache.log4j.PatternLayoutlog4j.appender.stdout.layout.ConversionPattern=%p %d{yyyy-MM-dd HH:mm:ss} %c:%L – %m%nlog4j.category.org.springframework = ON

<?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:tx=”http://www.springframework.org/schema/tx”xmlns:aop=”http://www.springframework.org/schema/aop”xmlns:context=”http://www.springframework.org/schema/context”xsi:schemaLocation=”http://www.springframework.org/schema/beans”default-autowire=”byName”><context:property-placeholder location=”classpath*:jdbc.properties”/><context:component-scan base-package=”com.lavasoft.demo.dao” /><context:component-scan base-package=”com.lavasoft.demo.service”/><context:component-scan base-package=”com.lavasoft.demo.web.action”/><!– 配置系统的数据源 –><bean init-method=”init” destroy-method=”close”><property value=”${jdbc.driver}”/><property value=”${jdbc.url}”/><property value=”${jdbc.username}”/><property value=”${jdbc.password}”/><property value=”stat”/><property value=”10″/><property value=”1″/><property value=”60000″/><property value=”1″/><property value=”60000″/><property value=”300000″/><property value=”SELECT ‘x'”/><property value=”true”/><property value=”false”/><property value=”false”/><property value=”true”/><property value=”50″/><property value=”100″/></bean><bean><property ref=”dataSource”/><property><props><prop key=”hibernate.dialect”>org.hibernate.dialect.MySQL5InnoDBDialect</prop><prop key=”hibernate.current_session_context_class”>thread</prop><prop key=”hibernate.show_sql”>true</prop><prop key=”hibernate.format_sql”>true</prop><prop key=”hibernate.hbm2ddl.auto”>update</prop></props></property><property value=”com.lavasoft.demo.entity”/></bean><bean><property ref=”sessionFactory”/></bean><tx:advice transaction-manager=”transactionManager”><tx:attributes><tx:method read-only=”true”/><tx:method read-only=”true”/><tx:method read-only=”true”/><tx:method read-only=”true”/><tx:method read-only=”true”/><tx:method read-only=”true”/><tx:method/><tx:method propagation=”REQUIRED” rollback-for=”Exception”/></tx:attributes></tx:advice><aop:config><aop:pointcut expression=”execution(* com.lavasoft.demo.service.*Impl.*(..))”/><aop:advisor advice-ref=”txAdvice” pointcut-ref=”pointcut”/></aop:config></beans>

<?xml version=”1.0″ encoding=”UTF-8″?><!DOCTYPE struts PUBLIC”-//Apache Software Foundation//DTD Struts Configuration 2.3//EN””http://struts.apache.org/dtds/struts-2.3.dtd”><struts><constant value=”true”/><constant value=”UTF-8″ /><constant value=”/WEB-INF/pages”/><constant value=”web,action”/><constant value=”spring”/><constant value=”true”/><package extends=”struts-default” namespace=”/demo”><global-results><result>/index.jsp</result><result>/error.jsp</result></global-results></package></struts>

<?xml version=”1.0″ encoding=”UTF-8″?><web-app version=”2.5″ xmlns=”http://java.sun.com/xml/ns/javaee”xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”xsi:schemaLocation=”http://java.sun.com/xml/ns/javaee”><welcome-file-list><welcome-file>login.html</welcome-file></welcome-file-list><filter><filter-name>encodingFilter</filter-name><filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class><init-param><param-name>encoding</param-name><param-value>UTF-8</param-value></init-param></filter><filter-mapping><filter-name>encodingFilter</filter-name><url-pattern>/*</url-pattern></filter-mapping><filter><filter-name>struts2</filter-name><filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class></filter><filter-mapping><filter-name>struts2</filter-name><url-pattern>/*</url-pattern></filter-mapping><context-param><param-name>log4jConfigLocation</param-name><param-value>classpath:log4j.properties</param-value></context-param><listener><listener-class>org.springframework.web.util.Log4jConfigListener</listener-class></listener><context-param><param-name>contextConfigLocation</param-name><param-value>classpath:spring-config.xml</param-value></context-param><listener><listener-class>org.springframework.web.context.ContextLoaderListener</listener-class></listener><listener><listener-class>org.springframework.web.context.request.RequestContextListener</listener-class></listener><listener><listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class></listener></web-app>你可以用爱得到全世界,你也可以用恨失去全世界

Struts2.3+Spring3.2.8+Hibernate4.1全注解配置

相关文章:

你感兴趣的文章:

标签云: