zoukankan      html  css  js  c++  java
  • Spring常用xml配置

    普通配置
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
    https://www.springframework.org/schema/beans/spring-beans.xsd">
    </beans>

    spring-aop配置
    <?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"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
    https://www.springframework.org/schema/beans/spring-beans.xsd
    http://www.springframework.org/schema/context
    https://www.springframework.org/schema/context/spring-context.xsd">
    <context:annotation-config/>
    </beans>
    spring-mybatis-mysql配置
    <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
    <property name="url" value="jdbc:mysql://localhost:3306/mybatis?useUnicode=true&amp;ampcharacterEncoding=UTF8&amp;serverTimezone=GMT%2B8&amp;useSSL=false"/>
    <property name="username" value="root"/>
    <property name="password" value="mysql"/>
    </bean>


    spring开启注解支持配置
      
    <?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"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
    https://www.springframework.org/schema/beans/spring-beans.xsd
    http://www.springframework.org/schema/context
    https://www.springframework.org/schema/context/spring-context.xsd">

    <!--指定要扫描的包 这个包下的注解就会生效-->
    <context:component-scan base-package="com.lxy"/>
    <context:annotation-config/>
    </beans>


    解决资源拦截问题
    <build>
    <resources>
    <resource>
    <directory>src/main/resources</directory>
    <includes>
    <include>**/*.properties</include>
    <include>**/*.xml</include>
    </includes>
    </resource>
    <resource>
    <directory>src/main/java</directory>
    <includes>
    <include>**/*.properties</include>
    <include>**/*.xml</include>
    </includes>
    <filtering>true</filtering>
    </resource>
    </resources>
    </build>
    
    
  • 相关阅读:
    28图结构的类实现
    27图的拓扑排序
    26最短路径之Floyd算法
    25最短路径之Dijkstra算法
    24最小生成树之Prim算法
    23最小生成树之Kruskal算法
    22-1图的遍历的源代码
    22图的遍历
    21图结构的基本概念
    20树结构的类实现
  • 原文地址:https://www.cnblogs.com/lxy-java/p/12817269.html
Copyright © 2011-2022 走看看