spring-web-context.xml 19.4 KB
<?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:p="http://www.springframework.org/schema/p"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:util="http://www.springframework.org/schema/util"
       xmlns:aop="http://www.springframework.org/schema/aop"
       xmlns:mvc="http://www.springframework.org/schema/mvc"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
                        http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
                        http://www.springframework.org/schema/context
                        http://www.springframework.org/schema/context/spring-context-3.1.xsd
                        http://www.springframework.org/schema/util
                        http://www.springframework.org/schema/util/spring-util.xsd
                        http://www.springframework.org/schema/aop
                        http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
                        http://www.springframework.org/schema/mvc
                        http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd">

    <aop:aspectj-autoproxy proxy-target-class="true"/>
    <context:property-placeholder ignore-resource-not-found="true" location="classpath*:config.properties"/>

    <!-- Spring扫描目录,通过注解的方式注入bean,只扫描本工程的目录 -->
    <context:component-scan base-package="com.yohobuy"/>
    <bean id="serviceGlobalExceptionHandler" class="com.yoho.error.exception.handler.ServiceGlobalExceptionHandler"/>

    <!-- 启动SpringMVC的注解功能,完成请求和注解POJO的映射 -->
    <mvc:annotation-driven>
        <mvc:message-converters>
            <ref bean="stringConverter"/>
            <ref bean="jsonConverter"/>
        </mvc:message-converters>
    </mvc:annotation-driven>

    <!--字符串转换器-->
    <bean id="stringConverter"
          class="org.springframework.http.converter.StringHttpMessageConverter">
        <property name="supportedMediaTypes">
            <list>
                <value>text/plain;charset=UTF-8</value>
            </list>
        </property>
    </bean>

    <!-- json转换器  application/json -->
    <bean id="jsonConverter"
          class="com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter">
        <property name="features">
            <array>
                <value>DisableCircularReferenceDetect</value>
            </array>
        </property>
    </bean>

    <!-- 配置MultipartResolver 用于文件上传 使用spring的CommosMultipartResolver -->
    <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
        <property name="defaultEncoding" value="UTF-8"></property>
        <property name="maxUploadSize" value="${file.maxsize}"></property>
        <!-- <property name="uploadTempDir" value="${file.uploadTempDir}"></property>-->
        <property name="resolveLazily" value="true"></property>
    </bean>

    <!-- 批量操作服务定义 -->
    <util:map id="batchImportBusiness" key-type="java.lang.String"
              value-type="com.yohobuy.platform.common.service.IBusinessImportService">
<!--        <entry key="price" value-ref="PriceImportServiceImpl"></entry>
        <entry key="brandCooperation" value-ref="brandCooperationImportServiceImpl"></entry>
        <entry key="productPool" value-ref="productPoolImportServiceImpl"></entry>
        <entry key="brandProperty" value-ref="BrandPropertyImportService"></entry>
        <entry key="searchSort" value-ref="SearchSortImportService"></entry>
        <entry key="baseProduct" value-ref="baseProductImportServiceImpl"></entry>
        <entry key="productImg" value-ref="batchProdImgImportServiceImpl"></entry>
        <entry key="productModelTry" value-ref="prodModelTryImportServiceImpl"></entry>
        <entry key="outletModify" value-ref="batchModifyOutletImportServiceImpl"></entry>
        <entry key="supplyModify" value-ref="batchModifySupplyImportServiceImpl"></entry>
        <entry key="drawlineUserQueue" value-ref="DrawlineUserQueueImportServiceImpl"></entry>
        <entry key="yohoCoin" value-ref="yohoCoinImportServiceImpl"></entry>
        <entry key="payDeliveryModify" value-ref="batchModifyPayDeliveryImportServiceImpl"></entry>-->
        <entry key="activityProduct" value-ref="activityProductService"></entry>
        <!--<entry key="refundExchangeModify" value-ref="batchModifyRefundExchangeImportServiceImpl"></entry>
        <entry key="skuFactoryCodeModify" value-ref="updateSkuFactoryCodeServiceImpl"></entry>
        <entry key="appTypeModify" value-ref="batchModifyAppTypeImportServiceImpl"></entry>
        <entry key="productSaleModify" value-ref="batchModifyProductSaleImportServiceImpl"></entry>
        <entry key="storeProductSaleModify" value-ref="batchModifyStoreProductSaleImportServiceImpl"></entry>
        <entry key="productTagModify" value-ref="productTagImportServiceImpl"></entry>
        <entry key="productPriceAudit" value-ref="batchAuditProductPriceServiceImpl"></entry>
        <entry key="offShelveSkn" value-ref="OffShelveSknImportService"></entry>
        <entry key="studentPrice" value-ref="studentPriceImportService" />
        <entry key="limitProductUid" value-ref="limitUidImportServiceImpl"></entry>
        <entry key="onShelveSkn" value-ref="onShelveBatchSknImportService" />
        <entry key="categoryLinkProduct" value-ref="categoryLinkProductImportServiceImpl"></entry>
        <entry key="batchSknLink" value-ref="batchSknLinkImportServiceImpl"></entry>
        <entry key="secKill" value-ref="seckillImportServiceImpl"></entry>
        <entry key="shopsPromote" value-ref="shopsPromoteImportService" />
        <entry key="depositAdvance" value-ref="depositAdvanceImportServiceImpl"></entry>
        <entry key="depositAdvanceTime" value-ref="depositAdvanceTimeImportImpl"></entry>
        <entry key="productSingleDay" value-ref="productSingleDayService" />-->
        <entry key="makePromtion" value-ref="MakePromotionImportServiceImpl"></entry>
        <!--<entry key="productSingleDay" value-ref="productSingleDayService" />
        <entry key="productBundle" value-ref="productBundleService" />
        <entry key="productBatch" value-ref="productBatchService" />
        <entry key="sockpupetCommentsImport" value-ref="sockpupetCommentsImportServiceImpl"/>
        <entry key="makePriceItemImport" value-ref="makePriceServiceImpl"/>
        <entry key="productBuyLimitImport" value-ref="productBuyLimitServiceImpl"/>
        <entry key="promotionPhrase" value-ref="PhraseBatchImportService"/>
        <entry key="skcFactoryCode" value-ref="updateSkcFactoryCodeServiceImpl"/>
        <entry key="sknYearAndSeason" value-ref="updateSknYearAndSeasonImpl"/>
        <entry key="skuUpmCode" value-ref="updateUpmServiceImpl"/>
        <entry key="brandSaleTime" value-ref="productBrandSaleTimeService"/>
        <entry key="brandClassic" value-ref="productBrandClassicService"/>
        <entry key="expectSaleTime" value-ref="productExpectSaleTimeService"/>
        <entry key="brandImageBatch" value-ref="batchBrandImgImportServiceImpl"/>
        <entry key="productPhrase" value-ref="productPhraseImportService"/>
        <entry key="productSknImport" value-ref="productSknImportServiceImpl"/>
        <entry key="productMaterialImport" value-ref="productMaterialServiceImpl"/>
        <entry key="recProduct" value-ref="newUserRecProductImportServiceImpl"></entry>
        <entry key="vipBatch" value-ref="vipServiceImpl"></entry>
        <entry key="couponLimitImport" value-ref="couponLimitServiceImpl"></entry>
        <entry key="activitySknImport" value-ref="activityRegistrationProductServiceImpl"></entry>
        <entry key="sellerProductImport" value-ref="sellerProductImportService"></entry>
        <entry key="unionUrlImport" value-ref="unionUrlImportServiceImpl"></entry>
        <entry key="couponProductLimit" value-ref="couponProductLimitImportService"></entry>
        <entry key="depositPrdImport" value-ref="depositPrdImportService"/>
        <entry key="shopCrossRecServiceImpl" value-ref="shopCrossRecServiceImpl"></entry>
        <entry key="advancePrdImport" value-ref="advancePrdImportService"></entry>
        <entry key="updateSknName" value-ref="updateProductNameService"></entry>
        <entry key="downSknName" value-ref="downloadProductNameService"></entry>
        <entry key="productPoolBatchDel" value-ref="ProductPoolBatchDelImportServiceImpl"></entry>
        <entry key="followPriceImport" value-ref="followPriceOperateService"></entry>
        <entry key="nationalCodeImportService" value-ref="nationalCodeImportService"></entry>
        <entry key="newNationalCodeImportService" value-ref="newNationalCodeImportService"></entry>
        <entry key="collageImport" value-ref="collageProductServiceImpl"></entry>
        <entry key="depositPrdDelImport" value-ref="depositPrdDelImportService" />
        <entry key="reportFormChannelIdService" value-ref="reportFormChannelIdServiceImpl"/>
        <entry key="distributionBatchImportService" value-ref="distributionBatchImportServiceImpl"/>
        <entry key="shopCouponLimitImport" value-ref="shopCouponLimitServiceImpl"></entry>
        <entry key="priceUpdateImport" value-ref="priceUpdateImportServiceImpl"></entry>
        <entry key="vipReturnCoinBatch" value-ref="vipReturnCoinServiceImpl"></entry>
        <entry key="changeSize" value-ref="changeSizeImportServiceImpl"></entry>-->
    </util:map>
    <!-- 批量操作服务定义 -->
    <util:map id="batchExportBusiness" key-type="java.lang.String"
              value-type="com.yohobuy.platform.common.service.IBusinessExportService">
        <!--<entry key="netSale" value-ref="NetSaleExportServiceImpl"></entry>
        <entry key="limitProductReminder" value-ref="LimitProductExportServiceImpl"></entry>
        <entry key="drawlineUserQueue" value-ref="DrawlineUserQueueExportServiceImpl"></entry>
        <entry key="yohoCoin" value-ref="yohoCoinExportService"></entry>-->
        <entry key="suggestExport" value-ref="suggestExportService"/>
        <entry key="linkExport" value-ref="linkExportService"/>
        <entry key="linkBatchExport" value-ref="linkBatchExportService"/>
       <!-- <entry key="brandPayDeliveryExport" value-ref="brandPayDeliveryExportServiceImpl"></entry>
        <entry key="brandPayDeliveryCheckExport" value-ref="brandPayDeliveryCheckExportServiceImpl"></entry>
        <entry key="productPayDeliveryExport" value-ref="productPayDeliveryExportServiceImpl"></entry>
        <entry key="couponLogsExport" value-ref="couponLogsExportServiceImpl"></entry>
        <entry key="useCouponLogsExport" value-ref="useCouponLogsExportServiceImpl"></entry>
        <entry key="pCouponSnsExport" value-ref="pcouponSnsExportServiceImpl"></entry>
        <entry key="baseProduce" value-ref="baseProduceExportServiceImpl"/>
        <entry key="productRefundExchangeExport" value-ref="productRefundExchangeExportServiceImpl"></entry>
        <entry key="productSortRefundExchangeExport" value-ref="productSortRefundExchangeExportServiceImpl"></entry>
        <entry key="couponSendErrorExport" value-ref="couponSendErrorExportService"/>
        <entry key="instalmentSknsExport" value-ref="instalmentSknsExportServiceImpl"/>
        <entry key="shopSaleExport" value-ref="shopSaleExportServiceImpl"/>
        <entry key="productSaleExport" value-ref="productSaleExportServiceImpl"/>
        <entry key="productSaleOnShelvesExport" value-ref="productSaleOnShelvesExportServiceImpl"/>
        <entry key="limitProductUid" value-ref="limitUidExportServiceImpl" />
        <entry key="sns" value-ref="showCommentExportService" />
        <entry key="changePriceExport" value-ref="changePriceExportServiceImpl"/>
        <entry key="productPriceExport" value-ref="productPriceExportServiceImpl"/>-->
        <entry key="makePromotionExportServiceImpl" value-ref="MakePromotionExportServiceImpl"/>
       <!-- <entry key="userCouponHistoryExport" value-ref="userCouponHistoryExportService"/>
        <entry key="userShareHistoryExport" value-ref="userShareHistoryExportService"/>
        <entry key="productBatchServiceExport" value-ref="productBatchServiceExportImpl"/>
        <entry key="productBundleServiceExport" value-ref="productBundleServiceExportImpl"/>
        <entry key="exportConsultServiceExport" value-ref="exportConsultServiceImpl"/>
        <entry key="productTagServiceExport" value-ref="productTagExportServiceImpl"/>
        <entry key="channelProductServiceExport" value-ref="channelProductServiceExportImpl"/>
        <entry key="promotionPhraseExport" value-ref="promotionPhraseExportImpl"/>
        <entry key="reportFormExport" value-ref="reportFormServiceImpl"/>
        <entry key="channelProductServiceExport" value-ref="channelProductServiceExportImpl"/>
        <entry key="productExportServiceImpl" value-ref="productExportService"/>
        <entry key="timeLimitDepositImportErrorMsgExport" value-ref="timeLimitDepositImportErrorMsgExportService" />
        <entry key="couponExport" value-ref="couponExportService" />
        <entry key="distributionBatchExportService" value-ref="distributionBatchExportServiceImpl"/>
        <entry key="collageActivityExport" value-ref="collageActivitiesServiceImpl" />
        <entry key="batchExportReturnCoin" value-ref="VipReturnCoinExportServiceImpl" />-->
    </util:map>
    <!-- 批量操作服务定义 -->


    <!-- 批量操作服务定义 -->


    <!--service接口调用拦截器-->
    <!--<bean id="serviceMethodInterceptor" class="com.yoho.core.common.monitor.interceptor.MethodProfileInterceptor">-->
    <!--</bean>-->
    <!--<aop:config>-->
    <!--<aop:pointcut id="serviceMethodPoint"-->
    <!--expression="(execution(* com.yohobuy.platform.*.service.*.*(..))) or (execution(* com.yohobuy.platform.*.restapi.*.*(..))) "/>-->
    <!--<aop:advisor pointcut-ref="serviceMethodPoint" advice-ref="serviceMethodInterceptor"/>-->
    <!--</aop:config>-->

    <!-- 图片批量上传异步线程池 -->
    <bean id="threadPool" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor">
        <property name="corePoolSize" value="5"/>
        <property name="maxPoolSize" value="20"/>
        <property name="queueCapacity" value="1000"/>
        <property name="keepAliveSeconds" value="300"/>
        <property name="rejectedExecutionHandler">
            <bean class="java.util.concurrent.ThreadPoolExecutor$CallerRunsPolicy"/>
        </property>
    </bean>

    <!--操作日志的拦截器-->
    <bean id="operateRecodeAnnotationInterceptor" class="com.yohobuy.platform.common.interceptor.OperateRecodeInterceptor">
        <property name="sellerControllerPath" value="com.yohobuy.platform.seller"></property>
    </bean>
    <aop:config>
        <aop:pointcut id="operateRecodeAnnotionPoint"
                      expression="within(@org.springframework.stereotype.Controller * or @org.springframework.web.bind.annotation.RestController *)"/>
        <aop:advisor pointcut-ref="operateRecodeAnnotionPoint" advice-ref="operateRecodeAnnotationInterceptor"/>
    </aop:config>


    <!-- 平台redis配置
    <bean id="platformRedisTemplate"
          class="com.yoho.core.redis.cluster.operations.nosync.YHRedisTemplate" primary="true"
          p:connectionFactory-ref="platformJedisConnectionFactory"
          p:keySerializer-ref="stringRedisSerializer"
          p:valueSerializer-ref="integerRedisSerializer"/>

    <bean id="platformJedisConnectionFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory"
          p:timeout="1000"
          p:poolConfig-ref="jedisPoolConfig"
          p:hostName="${platformRedis.proxy.address}"
          p:port="${platformRedis.proxy.port}"
          p:password="${platformRedis.proxy.auth}"
          p:database="${platformRedis.proxy.database:0}" primary="true" />
    <bean id="jedisPoolConfig" class="redis.clients.jedis.JedisPoolConfig">
        <property name="maxTotal" value="100" />
        <property name="maxIdle" value="100" />
        <property name="minIdle" value="50" />
        <property name="maxWaitMillis" value="${platformRedis.pool.maxWaitMillis:2000}" />
        <property name="testOnBorrow" value="${platformRedis.pool.testOnBorrow:false}" />
        <property name="testWhileIdle" value="${platformRedis.pool.testWhileIdle:false}" />
    </bean>
    <bean id="stringRedisSerializer"
          class="org.springframework.data.redis.serializer.StringRedisSerializer"/>
    <bean id="integerRedisSerializer"
          class="com.yohobuy.platform.common.service.redis.IntegerRedisSerializer"/>
     -->
    <!-- 平台redis配置
    <bean id="platformRedisTemplateEx"
          class="com.yoho.core.redis.YHRedisTemplate" primary="true"
          p:connectionFactory-ref="platformJedisConnectionFactory"
          p:keySerializer-ref="stringRedisSerializer"
          p:valueSerializer-ref="stringRedisSerializer"/>
          -->

    <!-- 大数据redis配置
    <bean id="unionRedisTemplate"
          class="com.yoho.core.redis.YHRedisTemplate" primary="false"
          p:connectionFactory-ref="unionJedisConnectionFactory"
          p:keySerializer-ref="stringRedisSerializer"
          p:valueSerializer-ref="stringRedisSerializer"
          p:hashKeySerializer-ref="stringRedisSerializer"
          p:hashValueSerializer-ref="stringRedisSerializer"
          p:redisCacheClean-ref="redisCacheClean"
          />
    <bean id="unionJedisConnectionFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory"
          p:timeout="1000"
          p:poolConfig-ref="jedisPoolConfig"
          p:hostName="${unionRedis.proxy.address}"
          p:port="${unionRedis.proxy.port}"
          p:password="${unionRedis.proxy.auth}"
          p:database="${unionRedis.proxy.database:0}" primary="false" />
    <bean id="unionHashOperations" class="com.yoho.core.redis.YHHashOperations"
        p:hashOperations-ref="unionRedisTemplate" p:hashOperationsReadOnly-ref="unionRedisTemplate" p:redisCacheClean-ref="redisCacheClean"/>
    <bean id="unionValueOperations" class="com.yoho.core.redis.YHValueOperations"
        p:valueOperations-ref="unionRedisTemplate" p:valueOperationsReadOnly-ref="unionRedisTemplate" p:redisCacheClean-ref="redisCacheClean"/>
    <bean id="unionListOperations" class="com.yoho.core.redis.YHListOperations"
          p:listOperations-ref="unionRedisTemplate" p:listOperationsReadOnly-ref="unionRedisTemplate" p:redisCacheClean-ref="redisCacheClean"/>
    -->
    <!--XSS请求的拦截器-->
   <!-- <bean id="xssInterceptor" class="com.yohobuy.platform.seller.common.interceptor.XssInterceptor">
        <property name="sellerControllerPath" value="com.yohobuy.platform.seller"></property>
        <property name="specialMethodList">
            <set>
                <value>getProduct</value>
            </set>
        </property>
        <property name="xssRequestWrapper" ref="xssRequestWrapper"></property>
    </bean>
    <aop:config>
        <aop:pointcut id="xssAnnotionPoint"
                      expression="within(@org.springframework.stereotype.Controller * or @org.springframework.web.bind.annotation.RestController *)"/>
        <aop:advisor pointcut-ref="xssAnnotionPoint" advice-ref="xssInterceptor"/>
    </aop:config>-->

    <bean id="batchForkJoinPool" class="java.util.concurrent.ForkJoinPool" >
    </bean>

    <!--Excel模板生成器配置-->
    <util:map id="TemplateCreators" key-type="java.lang.String"
              value-type="com.yohobuy.platform.common.service.IExcelTemplatService">
        <!--商家端批量创建商品模板-->
    </util:map>
</beans>