<?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:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:jpa="http://www.springframework.org/schema/data/jpa"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">
<!--指明 controller 所在包,并扫描其中的注解-->
<context:component-scan base-package="com.onion.controller"/>
<!-- 静态资源(js、image等)的访问 -->
<mvc:default-servlet-handler/>
<!-- 开启注解 -->
<mvc:annotation-driven/>
<!--ViewResolver 视图解析器-->
<!--用于支持Servlet、JSP视图解析-->
<bean id="jspViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
<property name="prefix" value="/WEB-INF/pages/"/>
<property name="suffix" value=".jsp"/>
</bean>
<!-- 表示JPA Repository所在的包 -->
<jpa:repositories base-package="com.onion.repository"/>
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="persistenceUnitName" value="defaultPersistenceUnit"/>
<property name="packagesToScan" value="com.onion.model" />
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"/>
</property>
<property name="jpaProperties">
<props>
<prop key="hibernate.connection.driver_class">com.mysql.jdbc.Driver</prop>
<prop key="hibernate.connection.url">jdbc:mysql://192.168.6.161:3306/springdemo?useSSL=false</prop>
<prop key="hibernate.connection.username">root</prop>
<prop key="hibernate.connection.password">987654</prop>
<prop key="hibernate.show_sql">false</prop>
<prop key="hibernate.connection.useUnicode">true</prop>
<prop key="hibernate.connection.characterEncoding">UTF-8</prop>
<prop key="hibernate.format_sql">true</prop>
<prop key="hibernate.use_sql_comments">true</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
<prop key="hibernate.connection.autoReconnect">true</prop>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</prop>
<prop key="connection.autoReconnectForPools">true</prop>
<prop key="connection.is-connection-validation-required">true</prop>
<prop key="hibernate.c3p0.validate">true</prop>
<prop key="hibernate.connection.provider_class">org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider</prop>
<prop key="hibernate.c3p0.min_size">5</prop>
<prop key="hibernate.c3p0.max_size">600</prop>
<prop key="hibernate.c3p0.timeout">1800</prop>
<prop key="hibernate.c3p0.max_statements">50</prop>
<prop key="hibernate.c3p0.preferredTestQuery">SELECT 1;</prop>
<prop key="hibernate.c3p0.testConnectionOnCheckout">true</prop>
<prop key="hibernate.c3p0.idle_test_period">3000</prop>
</props>
</property>
</bean>
<!-- 事务管理 -->
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory"/>
</bean>
<!-- 开启事务管理注解 -->
<tx:annotation-driven transaction-manager="transactionManager"/>
</beans>
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
基于springmvc+maven+hibernate做的一个简易博客系统,方便对于springmvc的掌握和入门,按照过程一个个自己实践,相信会有一个不错的入门效果(仅作为入门,掌握springmvc和hibernate(JPA)所用,比如对于JPARepository的扩展和使用等) attention:正式开始前,请检查自己的环境(javaJDK,maven均正常,安装和检查过程请摆渡)
资源推荐
资源详情
资源评论
收起资源包目录
springmvcdemo.rar (57个子文件)
META-INF
maven
com.onion
springmvcdemo
pom.xml 2KB
pom.properties 119B
MANIFEST.MF 131B
WEB-INF
mvc-dispatcher-servlet.xml 4KB
web.xml 1KB
pages
admin
users.jsp 3KB
addUser.jsp 3KB
updateUser.jsp 3KB
details.jsp 2KB
index.jsp 1KB
classes
admin
users.jsp 3KB
addUser.jsp 3KB
updateUser.jsp 3KB
details.jsp 2KB
users.jsp 3KB
addUser.jsp 3KB
META-INF
updateUser.jsp 3KB
com
onion
repository
UserRepository.class 1KB
model
UserEntity.class 3KB
BlogEntity.class 3KB
controller
MainController.class 4KB
index.jsp 1KB
details.jsp 2KB
lib
hibernate-jpa-2.1-api-1.0.0.Final.jar 111KB
jcl-over-slf4j-1.7.19.jar 16KB
dom4j-1.6.1.jar 307KB
hibernate-commons-annotations-5.0.1.Final.jar 74KB
javassist-3.20.0-GA.jar 733KB
aopalliance-1.0.jar 4KB
antlr-2.7.7.jar 435KB
geronimo-jta_1.1_spec-1.1.1.jar 16KB
hibernate-entitymanager-5.1.0.Final.jar 567KB
xml-apis-1.0.b2.jar 107KB
slf4j-api-1.7.19.jar 40KB
spring-webmvc-4.2.6.RELEASE.jar 857KB
mysql-connector-java-5.1.39.jar 966KB
c3p0-0.9.5.2.jar 486KB
spring-orm-4.2.5.RELEASE.jar 456KB
aspectjrt-1.8.9.jar 115KB
spring-context-4.2.6.RELEASE.jar 1.05MB
mchange-commons-java-0.2.11.jar 592KB
spring-expression-4.2.6.RELEASE.jar 257KB
spring-data-jpa-1.10.1.RELEASE.jar 266KB
spring-data-commons-1.12.1.RELEASE.jar 670KB
jandex-2.0.0.Final.jar 183KB
jstl-1.2.jar 405KB
spring-web-4.2.6.RELEASE.jar 749KB
jboss-logging-3.3.0.Final.jar 65KB
commons-logging-1.2.jar 60KB
spring-aop-4.2.5.RELEASE.jar 361KB
spring-core-4.2.6.RELEASE.jar 1.05MB
classmate-1.3.0.jar 63KB
spring-tx-4.2.5.RELEASE.jar 259KB
spring-beans-4.2.6.RELEASE.jar 714KB
spring-jdbc-4.2.5.RELEASE.jar 414KB
hibernate-core-5.1.0.Final.jar 5.42MB
hibernate-c3p0-5.1.0.Final.jar 11KB
共 57 条
- 1
资源评论
路松
- 粉丝: 16
- 资源: 15
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功