|
@@ -0,0 +1,92 @@
|
|
|
+<?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"
|
|
|
+ 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
|
|
|
+">
|
|
|
+
|
|
|
+
|
|
|
+ <!--json整合 需要导入 jackson-annotations-*.jar,jackson-core-.jar,jackson-databind-.jar -->
|
|
|
+ <bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping" />
|
|
|
+ <bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter">
|
|
|
+ <property name="messageConverters">
|
|
|
+ <list>
|
|
|
+ <bean class="org.springframework.http.converter.StringHttpMessageConverter">
|
|
|
+ <property name="supportedMediaTypes">
|
|
|
+ <list>
|
|
|
+ <value>text/html; charset=UTF-8</value>
|
|
|
+ <value>application/json;charset=UTF-8</value>
|
|
|
+ </list>
|
|
|
+ </property>
|
|
|
+ </bean>
|
|
|
+ <bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
|
|
|
+ <property name="supportedMediaTypes">
|
|
|
+ <list>
|
|
|
+ <value>text/html; charset=UTF-8</value>
|
|
|
+ <value>application/json;charset=UTF-8</value>
|
|
|
+ </list>
|
|
|
+ </property>
|
|
|
+ </bean>
|
|
|
+ </list>
|
|
|
+ </property>
|
|
|
+ </bean>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ <!-- 扫描包下所有类,为添加了@Service、@Component、@Controller、@Repository修饰的类创建对象并存入IOC容器-->
|
|
|
+<!-- <!– 规则–>-->
|
|
|
+<!-- <context:component-scan base-package="lsjb.controller.guizeController"></context:component-scan>-->
|
|
|
+<!-- <context:component-scan base-package="lsjb.service.guizeService"></context:component-scan>-->
|
|
|
+
|
|
|
+ <!-- 用户-->
|
|
|
+ <context:component-scan base-package="lsjb.controller.yonghuController"></context:component-scan>
|
|
|
+ <context:component-scan base-package="lsjb.service.yonghuService"></context:component-scan>
|
|
|
+
|
|
|
+
|
|
|
+ <mvc:default-servlet-handler></mvc:default-servlet-handler>
|
|
|
+ <mvc:annotation-driven></mvc:annotation-driven>
|
|
|
+
|
|
|
+
|
|
|
+ <bean id="gydxdb" class="org.apache.commons.dbcp2.BasicDataSource">
|
|
|
+ <property name="driverClassName" value="com.mysql.cj.jdbc.Driver"></property>
|
|
|
+ <property name="url" value="jdbc:mysql://47.92.102.27:53306/gydx"></property>
|
|
|
+ <property name="username" value="gydx"></property>
|
|
|
+ <property name="password" value="gydx123456"></property>
|
|
|
+ </bean>
|
|
|
+
|
|
|
+ <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
|
|
|
+ <property name="dataSource" ref="gydxdb"></property>
|
|
|
+ <property name="mapperLocations"
|
|
|
+ value="classpath:lsjb/mapper/yonghuMapper/yonghu.xml">
|
|
|
+
|
|
|
+ </property>
|
|
|
+
|
|
|
+ <!-- 显示SQL-->
|
|
|
+ <property name="configuration">
|
|
|
+ <bean class="org.apache.ibatis.session.Configuration">
|
|
|
+ <property name="logImpl" value="org.apache.ibatis.logging.stdout.StdOutImpl" />
|
|
|
+ </bean>
|
|
|
+ </property>
|
|
|
+ </bean>
|
|
|
+
|
|
|
+ <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
|
|
|
+ <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"></property>
|
|
|
+ <property name="basePackage"
|
|
|
+ value="lsjb.mapper.yonghuMapper">
|
|
|
+ </property>
|
|
|
+
|
|
|
+ </bean>
|
|
|
+
|
|
|
+ <bean id="transactionManger" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
|
|
|
+ <property name="dataSource" ref="gydxdb"></property>
|
|
|
+ </bean>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+</beans>
|