<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
	xmlns:aop="http://www.springframework.org/schema/aop"  
	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
    http://www.springframework.org/schema/aop  
    http://www.springframework.org/schema/aop/spring-aop.xsd">

	<context:component-scan base-package="com.huatek.frame.base" />
	<context:component-scan base-package="com.huatek.torch.frame.exception" /> 
	<context:component-scan base-package="com.huatek.torch.frame.body" />
	<context:component-scan base-package="com.huatek.torch.frame.validate" />
	<context:component-scan base-package="com.huatek.torch.frame.permission" />
	<context:component-scan base-package="com.huatek.torch.frame.log" />
	<aop:aspectj-autoproxy proxy-target-class="true" />
	
	<mvc:annotation-driven /> 

	<bean id="multipartResolver"
		class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
		<property name="maxUploadSize" value="104857600" />
		<property name="maxInMemorySize" value="4096" />
	</bean>
	<mvc:resources mapping="swagger-ui.html"
		location="classpath:/META-INF/resources/" />
	<mvc:resources mapping="/webjars/**"
		location="classpath:/META-INF/resources/webjars/" />
		
		<!-- 7\. zipkin 相关的配置 -->
    <bean id="sender" class="zipkin2.reporter.beans.OkHttpSenderFactoryBean">
        <property name="endpoint" value="http://localhost:9411/api/v2/spans"/>
    </bean>

    <bean id="tracing" class="brave.spring.beans.TracingFactoryBean">
        <property name="localServiceName" value="greeting-service"/>
        <property name="spanReporter">
            <bean class="zipkin2.reporter.beans.AsyncReporterFactoryBean">
                <property name="sender" ref="sender"/>
                <!-- wait up to half a second for any in-flight spans on close -->
                <property name="closeTimeout" value="500"/>
            </bean>
        </property>
        <property name="currentTraceContext">
            <bean class="brave.spring.beans.CurrentTraceContextFactoryBean">
                <property name="scopeDecorators">
                    <bean class="brave.context.slf4j.MDCScopeDecorator" factory-method="create"/>
                </property>
            </bean>
        </property>
    </bean>
</beans>