zoukankan      html  css  js  c++  java
  • spring的一些配置

    ApplicationContext配置

    <!-- 自动扫描包 加载annotation类 -->
    <context:component-scan base-package="com.xxx.xx" />
    
    <!-- 加载properties配置文件 -->
    <context:property-placeholder location="classpath:config.properties" />
    
    <!-- 加载JdbcTemplate配置文件 -->
    <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
          <property name="dataSource" ref="dataSource" />
    </bean>
    
    <!-- 加载dataSource配置文件 -->
    <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
          destroy-method="close">
          <property name="jdbcUrl" value="${jdbc.url}"></property>
          <property name="driverClass" value="${jdbc.driverClassName}"></property>
          <property name="user" value="${jdbc.username}"></property>
          <property name="password" value="${jdbc.password}"></property>
          <property name="maxPoolSize" value="40"></property>
          <property name="minPoolSize" value="1"></property>
          <property name="initialPoolSize" value="1"></property>
          <property name="maxIdleTime" value="20"></property>
    </bean>
    
    <aop:config>
          <!-- 切入点配置 -->
          <aop:pointcut expression="execution(public * com.prototype..*.*(..))" id="allPointcut"/>
          <aop:aspect id="logAspect" ref="logInterceptorForXml">
                <aop:before method="before" pointcut-ref="allPointcut"/>
                <aop:after method="after" pointcut-ref="allPointcut"/>
          </aop:aspect>
    </aop:config>

    SpringMVC配置

    <!-- 扫描 -->
    <context:component-scan base-package="com.prototype.controlle">
          <context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
    </context:component-scan>
    
    <!-- <mvc:view-controller path="/" view-name="index"/> -->
    
    <mvc:annotation-driven/>
    
    <mvc:resources location="/resource/" mapping="/resource/**"></mvc:resources>
    
    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix" value="/WEB-INF/view/"/>
        <property name="suffix" value=".jsp"/>
    </bean>
  • 相关阅读:
    联考20200520 T2 函数
    联考20200520 T1 石子游戏
    模拟赛T2 中继系统
    模拟赛T2 仙人掌毒题
    BZOJ3462 DZY Loves Math II
    20200129模拟赛T1 string
    BZOJ1316 树上的询问
    BZOJ4559 成绩比较
    JZOJ4238 纪念碑
    BZOJ 2648 世界树
  • 原文地址:https://www.cnblogs.com/timjames/p/8268114.html
Copyright © 2011-2022 走看看