bean

<?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/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd 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">

<!-- SpringSwagger 整合配置 -->
 <bean class="com.hifogroup.wiki.pay.config.swagger.SpringSwagger">
	<property name="title" value="TRADE API"/>
	<property name="version" value="1.0"/>
</bean>
<bean class="springfox.documentation.swagger2.configuration.Swagger2DocumentationConfiguration" />
<mvc:default-servlet-handler />
<mvc:resources location="/WEB-INF/view/resources/" mapping="api.html"/>
<mvc:resources location="/js/" mapping="/js/**"/>
<mvc:resources location="classpath:/META-INF/resources/webjars/" mapping="/webjars/**"/>
 
<bean id="propertyConfigurer"
	class="com.hifo.config.client.PropertyPlaceholderConfigurer">
	<property name="configClient" ref="configClient" />
</bean>

<bean id="configClient" class="com.hifo.config.client.ConfigClient">
	<property name="locations">
		<list>
			<value>classpath:config.properties</value>
		</list>
	</property>
</bean>

<!-- 自动扫描且只扫描[@Controller](https://my.oschina.net/u/1774615) -->
<context:component-scan base-package="com.hifogroup.wiki.pay.*"
	use-default-filters="false">
	<context:include-filter type="annotation"
		expression="org.springframework.stereotype.Controller" />
	<context:include-filter type="annotation"
		expression="org.springframework.web.bind.annotation.ControllerAdvice" />
</context:component-scan>



<mvc:annotation-driven>
	<mvc:message-converters register-defaults="true">
		<!-- 将StringHttpMessageConverter的默认编码设为UTF-8 -->
		<bean class="org.springframework.http.converter.StringHttpMessageConverter">
			<constructor-arg value="UTF-8" />
		</bean>
		<!-- 将Jackson2HttpMessageConverter的默认格式化输出设为true -->
		<bean
			class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
			<property name="prettyPrint" value="true" />
			<property name="prefixJson" value="false" />
			<property name="supportedMediaTypes">
				<list>
					<value>application/json</value>
					<value>text/json</value>
				</list>
			</property>
		</bean>
	</mvc:message-converters>
</mvc:annotation-driven>

<!-- 定义JSP文件的位置 -->
<bean
	class="org.springframework.web.servlet.view.InternalResourceViewResolver">
	<property name="prefix" value="/WEB-INF/views/" />
	<property name="suffix" value=".jsp" />
</bean>


<!-- 容器默认的DefaultServletHandler处理 所有静态内容与无RequestMapping处理的URL <mvc:default-servlet-handler />-->


<!-- 定义无需Controller的url<->view直接映射 -->
<!-- 	<mvc:view-controller path="/"
	view-name="redirect:/web/index.html" />
 -->
<!-- 将Controller抛出的异常转到特定View, 保持SiteMesh的装饰效果 -->
<!-- <bean
	class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver">
	<property name="exceptionMappings">
		<props>
			<prop key="java.lang.Throwable">error/500</prop>
		</props>
	</property>
</bean> -->

<bean id="multipartResolver"
	class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
	<property name="defaultEncoding" value="utf-8" />
	<property name="maxUploadSize" value="10485760000" />
	<property name="maxInMemorySize" value="40960" />
</bean>
	
<!-- 阿里支付参数注入 -->
<bean class="com.alipay.demo.trade.service.impl.AlipayTradeServiceImpl.ClientBuilder" id="alipayBuilder">
	<property name="alipayPublicKey" value="${ali.alipay_public_key}"></property>
	<property name="appid" value="${ali.appid}"></property>
	<property name="charset" value="utf-8"></property>
	<property name="format" value="json"></property>
	<property name="gatewayUrl" value="${ali.open_api_domain}"></property>
	<property name="privateKey" value="${ali.private_key}"></property>
	<property name="signType" value="${ali.sign_type}"></property>
</bean>

<!-- 微信service -->
<bean class="com.hifogroup.wiki.pay.alipay.TradeService" id="myTradeService">
	<constructor-arg ref="alipayBuilder"/>
</bean>



<!-- 微信支付参数注入 -->
<bean class="com.hifogroup.wiki.pay.wx.WXPayConfig1" id="qrconfig">
	<!-- <constructor-arg name="filePath" value="${wx.filePath}" /> -->
	<property name="key" value="${wx.qr.key}"/>
	<property name="appId" value="${wx.qr.appId}"/>
	<property name="mchid" value="${wx.qr.mchid}"/>
</bean>


<bean class="com.hifogroup.wiki.pay.wx.WXPayConfig" id="appconfig">
	<!-- <constructor-arg name="filePath" value="${wx.filePath}" /> -->
	<property name="key" value="${wx.app.key}"/>
	<property name="appId" value="${wx.app.appId}"/>
	<property name="mchid" value="${wx.app.mchid}"/>
</bean>

<!-- 微信 -->
<bean class="com.hifogroup.wiki.pay.wx.WXPay1" id="qrpay">
	<constructor-arg index="0" ref="qrconfig" />
	<constructor-arg index="1" value="false" />
	<constructor-arg index="2" value="false"/>
</bean>

<!-- 微信 -->
<bean class="com.hifogroup.wiki.pay.wx.WXPay" id="apppay">
	<constructor-arg index="0" ref="appconfig" />
	<constructor-arg index="1" value="false" />
	<constructor-arg index="2" value="false"/>
</bean>

</beans>

猜你喜欢

转载自my.oschina.net/zzp123456/blog/1823778
今日推荐