src/config/applicationContext.xml
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?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:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">
<!--配置spring创造容器时要扫描的包 -->
<context:component-scan base-package="com"></context:component-scan>
<!-- 配置hibernateTemplate -->
<bean id="hibernateTemplate" class="org.springframework.orm.hibernate5.HibernateTemplate">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<!--配置 sessionFactory-->
<bean id="sessionFactory" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean">
<!-- 1、连接数据库的 -->
<property name="dataSource" ref="dataSource"></property>
<!-- 2、hibernate基本配置的 -->
<property name="hibernateProperties">
<props>
<!-- 数据库的方言-->
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
<!-- 是否显示sql语句-->
<prop key="hibernate.show_sql">true</prop>
<!-- 是否格式化sql语句-->
<prop key="hibernate.format_sql">false</prop>
<!-- 采用何种方式生成数据库表结构 -->
<prop key="hibernate.hbm2ddl.auto">update</prop>
<!-- 是spring把sesion绑定到当前线程上的配置 -->
<prop key="hibernate.current_session_context_class">org.springframework.orm.hibernate5.SpringSessionContext</prop>
</props>
</property>
<!-- 3、指定扫描映射注解的包-->
<property name="packagesToScan">
<array>
<value>com.bean</value>
</array>
</property>
</bean>
<!-- 配置数据源 -->
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="driverClass" value="com.mysql.jdbc.Driver"></property>
<property name="jdbcUrl" value="jdbc:mysql://localhost:3306/crm_project"></property>
<property name="user" value="root"></property>
<property name="password" value="123"></property>
</bean>
<!-- 开启Spring对事务注解的支持 -->
<tx:annotation-driven transaction-manager="transactionManager"/>
后面还有 9 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。