<?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:aop="http://www.springframework.org/schema/aop"
|
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/aop
|
http://www.springframework.org/schema/aop/spring-aop.xsd">
|
|
<!--<bean id="helloController" class="com.example.controller.HelloController"></bean>-->
|
|
<!--开放注解功能-->
|
<context:annotation-config/>
|
<!--指定扫描和解析哪些包下面的类-->
|
<context:component-scan base-package="com.hxzk"/>
|
<context:component-scan base-package="com.hxzk.mapper"/>
|
<!-- springMVC需要配置对controller层的扫描,这个配置必须在mvc配置文件当中。否则springMVC无法把请求转到Controller层 -->
|
<!--开启mvc相关注解-->
|
<mvc:annotation-driven/>
|
|
<!--放行静态资源的-->
|
<mvc:resources mapping="/CSS/**" location="/CSS/"/>
|
<mvc:resources mapping="/JS/**" location="/JS/"/>
|
<mvc:resources mapping="/Home/**" location="/Home/"/>
|
<mvc:resources mapping="/Home/**" location="/Home/"/>
|
<mvc:resources mapping="/Home/**" location="/Home/"/>
|
<mvc:resources mapping="/TiaoZhuan/**" location="/TiaoZhuan/"/>
|
<mvc:resources mapping="/HouTai/**" location="/HouTai/"/>
|
<mvc:resources mapping="/api/**" location="/api/"/>
|
<mvc:resources mapping="/font/**" location="/font/"/>
|
<mvc:resources mapping="/Hindex/**" location="/Hindex/"/>
|
<mvc:resources mapping="/fengmap/**" location="/fengmap/"/>
|
<mvc:resources mapping="/images/**" location="/images/"/>
|
<mvc:resources mapping="/Icon/**" location="/Icon/"/>
|
|
<!--配置数据源-->
|
<bean id="ds" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
|
<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
|
<property name="url" value="jdbc:mysql:///hxzkuwb?characterEncoding=UTF8"/>
|
<property name="username" value="root"/>
|
<property name="password" value="123456"/>
|
</bean>
|
|
<!--配置Mybatis的SqlSessionFactoryBean-->
|
<bean id="sqlSessionFactory" class="com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean">
|
<property name="dataSource" ref="ds"/>
|
<!--分页-拦截器-->
|
<property name="plugins">
|
<array>
|
<bean class="com.github.pagehelper.PageInterceptor">
|
<property name="properties">
|
<!--使用下面的方式配置参数,一行配置一个(键=值)-->
|
<value>
|
helperDialect=mysql
|
</value>
|
</property>
|
</bean>
|
</array>
|
</property>
|
</bean>
|
<!-- 配置MapperScan:用来扫描用户自定义的mapper接口 -->
|
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
|
<property name="basePackage" value="com.hxzk.mapper"/>
|
</bean>
|
|
</beans>
|