<?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.busi" />
	<aop:aspectj-autoproxy proxy-target-class="true" />
	<mvc:annotation-driven />
	<mvc:default-servlet-handler />
	<!-- 2\. zipkin 相关的配置 -->
	<!-- 使用 OKHttp 来发送 trace 信息到 Zipkin Server。这里的 Zipkin Server 启动在本地 -->
	<bean id="sender"
		class="zipkin2.reporter.beans.OkHttpSenderFactoryBean">
		<property name="endpoint"
			value="http://localhost:9411" />
	</bean>

	<bean id="tracing" class="brave.spring.beans.TracingFactoryBean">
		<property name="localServiceName" value="hello-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>