阅读背景:

SSM框架的学习

来源:互联网 

 

1.基本配置文件  

applicationContext.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="https://www.springframework.org/schema/beans"
	xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xmlns:aop="https://www.springframework.org/schema/aop"
	xmlns:tx="https://www.springframework.org/schema/tx" xmlns:jdbc="https://www.springframework.org/schema/jdbc"
	xmlns:context="https://www.springframework.org/schema/context"
	xmlns:mvc="https://www.springframework.org/schema/mvc"
	xsi:schemaLocation="
     https://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context-3.0.xsd
     https://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans-3.0.xsd
     https://www.springframework.org/schema/jdbc https://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd
     https://www.springframework.org/schema/tx https://www.springframework.org/schema/tx/spring-tx-3.0.xsd
     https://www.springframework.org/schema/aop https://www.springframework.org/schema/aop/spring-aop-3.0.xsd
     https://www.springframework.org/schema/mvc https://www.springframework.org/schema/mvc/spring-mvc.xsd">
	
	
	

   <context:annotation-config />
	<context:component-scan base-package="cn.dxjava.www.service" />
	
  <!-- 加载jdbc属性文件 -->
 	<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="location" value="classpath:mysql.properties"></property>
    </bean>
 	
	<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">  
	
	 <property name="driverClassName">  
	  <value>${mdriver}</value>
	  </property>  
	  <property name="url">  
	      <value>${murl}</value>
	  </property>  
	  <property name="username">  
	      <value>${musername}</value>
	  </property>  
	  <property name="password">  
	      <value>${mpassword}</value>
	  </property>
	 
	  	<!--     <value>com.mysql.jdbc.Driver</value>   
	  </property>  
	  <property name="url">  
	      <value>jdbc:mysql://localhost:3306/how2java?characterEncoding=UTF-8</value>  
	
	  </property>  
	  <property name="username">  
	      <value>root</value>  
	  </property>  
	  <property name="password">  
	      <value>dxdx</value>  
	  </property>  --> 	
	  
	</bean>
	
	
	<bean id="sqlSession" class="org.mybatis.spring.SqlSessionFactoryBean">
		<property name="typeAliasesPackage" value="cn.dxjava.www.pojo" />
		<property name="dataSource" ref="dataSource"/>
		<property name="mapperLocations" value="classpath:cn/dxjava/www/mapper/*.xml"/>
	</bean>

	<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
		<property name="basePackage" value="cn.dxjava.www.mapper"/>
	</bean>
	


</beans>applicationContext.xml



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: