Toggle navigation
Toggle navigation
This project
Loading...
Sign in
ufo
/
yohoufo-fore
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
LUOXC
5 years ago
Commit
5c922ce4735a22d98d1e3be5b2ae749c1e103db2
1 parent
58391127
add ufoMethodProfilePointcut
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
107 additions
and
91 deletions
web/src/main/resources/META-INF/spring/spring-web-context.xml
web/src/main/resources/META-INF/spring/spring-web-context.xml
View file @
5c922ce
<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns:context=
"http://www.springframework.org/schema/context"
xmlns:task=
"http://www.springframework.org/schema/task"
xmlns:util=
"http://www.springframework.org/schema/util"
xmlns:aop=
"http://www.springframework.org/schema/aop"
xmlns:mvc=
"http://www.springframework.org/schema/mvc"
xmlns=
"http://www.springframework.org/schema/beans"
xmlns:p=
"http://www.springframework.org/schema/p"
xsi:schemaLocation=
"http://www.springframework.org/schema/beans
<beans
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns:context=
"http://www.springframework.org/schema/context"
xmlns:task=
"http://www.springframework.org/schema/task"
xmlns:util=
"http://www.springframework.org/schema/util"
xmlns:aop=
"http://www.springframework.org/schema/aop"
xmlns:mvc=
"http://www.springframework.org/schema/mvc"
xmlns=
"http://www.springframework.org/schema/beans"
xmlns:p=
"http://www.springframework.org/schema/p"
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
...
...
@@ -13,109 +16,122 @@
http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/task
http://www.springframework.org/schema/task/spring-task.xsd"
>
<mvc:resources
mapping=
"/html/**"
location=
"/html/"
/>
<aop:aspectj-autoproxy
/>
<context:property-placeholder
ignore-resource-not-found=
"true"
location=
"classpath*:config.properties"
/>
<mvc:resources
mapping=
"/html/**"
location=
"/html/"
/>
<aop:aspectj-autoproxy/>
<context:property-placeholder
ignore-resource-not-found=
"true"
location=
"classpath*:config.properties"
/>
<context:component-scan
base-package=
"com.yohoufo"
/>
<context:component-scan
base-package=
"com.yohoufo"
/>
<!-- 启动SpringMVC的注解功能,完成请求和注解POJO的映射 -->
<mvc:annotation-driven>
<mvc:message-converters
register-defaults=
"false"
>
<ref
bean=
"stringConverter"
/>
<ref
bean=
"jsonConverter"
/>
</mvc:message-converters>
</mvc:annotation-driven>
<!-- 启动SpringMVC的注解功能,完成请求和注解POJO的映射 -->
<mvc:annotation-driven>
<mvc:message-converters
register-defaults=
"false"
>
<ref
bean=
"stringConverter"
/>
<ref
bean=
"jsonConverter"
/>
</mvc:message-converters>
</mvc:annotation-driven>
<bean
id=
"stringRedisSerializer"
class=
"org.springframework.data.redis.serializer.StringRedisSerializer"
/>
<!-- byte[] 转换器 -->
<bean
class=
"org.springframework.http.converter.ByteArrayHttpMessageConverter"
/>
<!--字符串转换器 -->
<bean
id=
"stringConverter"
class=
"org.springframework.http.converter.StringHttpMessageConverter"
>
<property
name=
"supportedMediaTypes"
>
<list>
<value>
text/plain;charset=UTF-8
</value>
<value>
text/html;charset=UTF-8
</value>
</list>
</property>
</bean>
<!-- json转换器 application/json -->
<bean
id=
"jsonConverter"
class=
"com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter"
>
<property
name=
"supportedMediaTypes"
value=
"application/json;charset=UTF-8"
/>
<property
name=
"fastJsonConfig"
ref=
"fastJsonConfig"
/>
class=
"org.springframework.data.redis.serializer.StringRedisSerializer"
/>
<!-- byte[] 转换器 -->
<bean
class=
"org.springframework.http.converter.ByteArrayHttpMessageConverter"
/>
<!--字符串转换器 -->
<bean
id=
"stringConverter"
class=
"org.springframework.http.converter.StringHttpMessageConverter"
>
<property
name=
"supportedMediaTypes"
>
<list>
<value>
text/plain;charset=UTF-8
</value>
<value>
text/html;charset=UTF-8
</value>
</list>
</property>
</bean>
<!-- json转换器 application/json -->
<bean
id=
"jsonConverter"
class=
"com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter"
>
<property
name=
"supportedMediaTypes"
value=
"application/json;charset=UTF-8"
/>
<property
name=
"fastJsonConfig"
ref=
"fastJsonConfig"
/>
</bean>
<bean
id=
"fastJsonConfig"
class=
"com.alibaba.fastjson.support.config.FastJsonConfig"
>
<property
name=
"serializerFeatures"
>
<array
value-type=
"com.alibaba.fastjson.serializer.SerializerFeature"
>
<value>
WriteEnumUsingToString
</value>
<value>
DisableCircularReferenceDetect
</value>
</array>
</property>
</bean>
<bean
id=
"DisableCircularReferenceDetect"
class=
"org.springframework.beans.factory.config.FieldRetrievingFactoryBean"
>
<property
name=
"staticField"
value=
"com.alibaba.fastjson.serializer.SerializerFeature.DisableCircularReferenceDetect"
></property>
<bean
id=
"fastJsonConfig"
class=
"com.alibaba.fastjson.support.config.FastJsonConfig"
>
<property
name=
"serializerFeatures"
>
<array
value-type=
"com.alibaba.fastjson.serializer.SerializerFeature"
>
<value>
WriteEnumUsingToString
</value>
<value>
DisableCircularReferenceDetect
</value>
</array>
</property>
</bean>
<bean
id=
"DisableCircularReferenceDetect"
class=
"org.springframework.beans.factory.config.FieldRetrievingFactoryBean"
>
<property
name=
"staticField"
value=
"com.alibaba.fastjson.serializer.SerializerFeature.DisableCircularReferenceDetect"
></property>
</bean>
<!-- 配置MultipartResolver 用于文件上传 使用spring的CommosMultipartResolver -->
<bean
id=
"multipartResolver"
class=
"org.springframework.web.multipart.commons.CommonsMultipartResolver"
>
<property
name=
"defaultEncoding"
value=
"UTF-8"
></property>
<property
name=
"resolveLazily"
value=
"true"
></property>
</bean>
<!-- 配置MultipartResolver 用于文件上传 使用spring的CommosMultipartResolver -->
<bean
id=
"multipartResolver"
class=
"org.springframework.web.multipart.commons.CommonsMultipartResolver"
>
<property
name=
"defaultEncoding"
value=
"UTF-8"
></property>
<property
name=
"resolveLazily"
value=
"true"
></property>
</bean>
<task:annotation-driven
executor=
"myExecutor"
scheduler=
"myScheduler"
/>
<task:executor
id=
"myExecutor"
pool-size=
"5"
/>
<task:scheduler
id=
"myScheduler"
pool-size=
"10"
/>
<bean
id=
"handlebarsViewResolver"
class=
"com.github.jknack.handlebars.springmvc.HandlebarsViewResolver"
>
<property
name=
"prefix"
value=
"classpath:/conf/template"
/>
<property
name=
"suffix"
value=
".html"
/>
<property
name=
"contentType"
value=
"text/html;charset=UTF-8"
/>
</bean>
scheduler=
"myScheduler"
/>
<task:executor
id=
"myExecutor"
pool-size=
"5"
/>
<task:scheduler
id=
"myScheduler"
pool-size=
"10"
/>
<bean
id=
"handlebarsViewResolver"
class=
"com.github.jknack.handlebars.springmvc.HandlebarsViewResolver"
>
<property
name=
"prefix"
value=
"classpath:/conf/template"
/>
<property
name=
"suffix"
value=
".html"
/>
<property
name=
"contentType"
value=
"text/html;charset=UTF-8"
/>
</bean>
<!-- api文档配置 start -->
<!-- api文档配置 start -->
<!-- api文档配置 注解扫描器 -->
<bean
id=
"yohoApiAnnotationScanner"
class=
"com.yoho.tools.docs.YohoApiAnnotationScanner"
>
<!-- api文档配置 类名过滤器(正则)多个模式用英文逗号隔开 -->
<property
name=
"classFilterReg"
value=
"${yoho.api.docs.filter:^.*$}"
/>
<property
name=
"scanSwitch"
value=
"${yoho.api.docs.switch:off}"
/>
<bean
id=
"yohoApiAnnotationScanner"
class=
"com.yoho.tools.docs.YohoApiAnnotationScanner"
>
<!-- api文档配置 类名过滤器(正则)多个模式用英文逗号隔开 -->
<property
name=
"classFilterReg"
value=
"${yoho.api.docs.filter:^.*$}"
/>
<property
name=
"scanSwitch"
value=
"${yoho.api.docs.switch:off}"
/>
</bean>
<!-- api文档配置 end -->
<bean
id=
"ufoServiceCaller"
class=
"com.yohoufo.common.caller.UfoServiceCaller"
/>
<bean
id=
"eventBusPublisher"
class=
"com.yohoufo.common.alarm.EventBusPublisher"
>
<constructor-arg
name=
"executor"
ref=
"executor"
/>
</bean>
<task:executor
id=
"executor"
pool-size=
"20"
/>
<bean
id=
"accessStatistics"
class=
"com.yohoufo.common.interceptor.AccessStatistics"
/>
<!--Spring mvc 拦截器-->
<mvc:interceptors>
<ref
bean=
"trace.traceInterceptor"
/>
<ref
bean=
"threadProfileInterceptor"
/>
<ref
bean=
"localIpInterceptor"
/>
<ref
bean=
"securityInterceptor"
/>
<ref
bean=
"signatureVerifyInterceptor"
/>
<ref
bean=
"innerApiInterceptor"
/>
<ref
bean=
"accessStatistics"
/>
<ref
bean=
"bodyParamCheckInterceptor"
/>
</mvc:interceptors>
<!-- 上报influxdb 事件 -->
<bean
id=
"ufoInfluxdbEventHandler"
class=
"com.yohoufo.common.alarm.UfoInfluxdbEventHandler"
>
<property
name=
"eventReporter"
ref=
"eventReporter"
/>
<property
name=
"tag_context"
value=
"${web.context:default}"
/>
<!--<property name="cloud" value="${cloud:qcloud}"/>-->
</bean>
<bean
id=
"ufoServiceCaller"
class=
"com.yohoufo.common.caller.UfoServiceCaller"
/>
<bean
id=
"eventBusPublisher"
class=
"com.yohoufo.common.alarm.EventBusPublisher"
>
<constructor-arg
name=
"executor"
ref=
"executor"
/>
</bean>
<task:executor
id=
"executor"
pool-size=
"20"
/>
<bean
id=
"accessStatistics"
class=
"com.yohoufo.common.interceptor.AccessStatistics"
/>
<!--Spring mvc 拦截器-->
<mvc:interceptors>
<ref
bean=
"trace.traceInterceptor"
/>
<ref
bean=
"threadProfileInterceptor"
/>
<ref
bean=
"localIpInterceptor"
/>
<ref
bean=
"securityInterceptor"
/>
<ref
bean=
"signatureVerifyInterceptor"
/>
<ref
bean=
"innerApiInterceptor"
/>
<ref
bean=
"accessStatistics"
/>
<ref
bean=
"bodyParamCheckInterceptor"
/>
</mvc:interceptors>
<!-- 上报influxdb 事件 -->
<bean
id=
"ufoInfluxdbEventHandler"
class=
"com.yohoufo.common.alarm.UfoInfluxdbEventHandler"
>
<property
name=
"eventReporter"
ref=
"eventReporter"
/>
<property
name=
"tag_context"
value=
"${web.context:default}"
/>
<!--<property name="cloud" value="${cloud:qcloud}"/>-->
</bean>
<aop:config>
<aop:pointcut
id=
"ufoMethodProfilePointcut"
expression=
"
(execution(*
com.yohoufo.*.*.service..*.*(..)))
or
(execution(*
com.yohoufo.*.*.controller..*.*(..)))
or
(execution(*
com.yoho.core.redis.YH*Operations.*(..)))
or
(execution(*
com.yoho.core.redis.cluster.operations.nosync.*.*(..)))"
/>
<aop:advisor
pointcut-ref=
"ufoMethodProfilePointcut"
advice-ref=
"serviceMethodInterceptor"
/>
</aop:config>
</beans>
\ No newline at end of file
...
...
Please
register
or
login
to post a comment