当前位置: 首页 > news >正文

做外贸需要自己建网站吗即时设计怎么做网页

做外贸需要自己建网站吗,即时设计怎么做网页,靖江做网站,软文代写服务背景 业务组有一些给开发用的后门接口#xff0c;为了做到调用溯源#xff0c;业务组最近需要记录所有接口的访问记录#xff0c;暂时只需要记录接口的响应结果#xff0c;如果调用失败#xff0c;则记录异常信息。由于后门接口较多以及只是业务组内部轻度使用#xff0…背景 业务组有一些给开发用的后门接口为了做到调用溯源业务组最近需要记录所有接口的访问记录暂时只需要记录接口的响应结果如果调用失败则记录异常信息。由于后门接口较多以及只是业务组内部轻度使用因此使用了切面的方式实现。 方案 EnableAspectJAutoProxy Aspect Component Slf4j public class ResponseLogAspect {Resourceprivate CommonConstants commonConstants;Pointcut(annotation(*.log.ResponseLog))public void logPointcut() {}/*** 执行成功打印*/AfterReturning(pointcut logPointcut(), returning result)public void log(JoinPoint joinPoint, Object result) {try {// 降级开关if (!commonConstants.getBoolean(interface.response.log.switch, true)) {return;}ResponseLog annotation findAnnotation(joinPoint, ResponseLog.class);String metric metric(annotation.value(), joinPoint);log.info(interface success: {}, result: {}, metric, result);} catch (Exception e) {log.error(log error, e);QMonitor.recordOne(interface_response_log_fail);}}/*** 执行失败打印*/AfterThrowing(pointcut logPointcut(), throwing error)public void logError(JoinPoint joinPoint, Throwable error) {try {// 降级开关if (!commonConstants.getBoolean(interface.response.log.switch, true)) {return;}ResponseLog annotation findAnnotation(joinPoint, ResponseLog.class);String metric metric(annotation.value(), joinPoint);log.error(interface fail: {}, error: {}, metric, error.getMessage());} catch (Exception e) {log.error(log error, e);QMonitor.recordOne(interface_response_log_fail);}}/*** 监控指标* param specificName 具体指标名* param point 切点* return 指标名称*/private String metric(String specificName, JoinPoint point) {if (StringUtils.isBlank(specificName)) {String clz point.getTarget().getClass().getSimpleName();String mtd point.getSignature().getName();return clz _ mtd;} else {return specificName;}}/*** 注解查询* param point 切点* param annotationType 注解类型* return 注解信息*/private A extends Annotation A findAnnotation(JoinPoint point, ClassA annotationType) {MethodSignature signature (MethodSignature) point.getSignature();return AnnotationUtils.findAnnotation(signature.getMethod(), annotationType);} } 接下来只需要在后门接口上增加对应的注解即可 RequestMapping(value save, method RequestMethod.POST)ResponseBodyResponseLog(/voucher/save)public APIResponseBoolean save(HttpServletRequest request, RequestBody VoucherCommit voucherCommit) {// 代金券保存接口} 加餐 Target({ElementType.METHOD})指定该注解可以应用于方法。如果不加这个注解则表示默认该注解可以应用到类与方法上但是加上后就表示这个注解只能作用于方法否则会报错。springboot项目由于存在spring-boot-autoconfigure依赖会默认开启aop代理所以注解EnableAspectJAutoProxy可以不用加但是由于可以在配置文件中修改默认开启的逻辑所以建议加上避免失效。Pointcut注解中的参数within和annotation。annotation注解用于匹配那些具有指定注解的方法within注解用于匹配那些具有指定注解的类中的所有方法即使这些方法本身没有显式地标注注解。 // 切点匹配带有OnlyIntranetAccess注解的类Pointcut(within(org.openmmlab.platform.common.annotation.OnlyIntranetAccess))public void onlyIntranetAccessOnClass() {}// 切点匹配带有OnlyIntranetAccess注解的方法Pointcut(annotation(org.openmmlab.platform.common.annotation.OnlyIntranetAccess))public void onlyIntranetAccessOnMethed() {}
http://www.hkea.cn/news/14382881/

相关文章:

  • 白色网站源码wordpress文章签名插件
  • 山东省建设银行网站建设领域现场专业人员报名网站
  • wordpress 网站白屏wordpress模板安装后效果和预览不同
  • 潍坊公司注册网站医疗器械一类二类三类
  • 网站建设公司该如何选择wordpress 扩展
  • 自己怎么弄网站德阳网站怎么做seo
  • 易语言 做网站黑龙江建设教育信息网官网
  • 个人建站如何赚钱可以做微课ppt模板 网站有哪些
  • 网站认证主体怎么安装的wordpress主题
  • 墙蛙网站谁家做的建立什么样的网站赚钱
  • 网站横幅怎做服务器上的网站打不开
  • 北京网站设计与网站制作国内最厉害的公关团队
  • 网站建设全包设计wordpress主题排行榜
  • 成都彩蝶花卉网站建设案例龙岗建设网站制作
  • 网站模版的优化公司做个网站
  • 自己做的网站 能收索么vs2010网站开发教程
  • 福建省网站建设成都网站设计得多少钱
  • 图片直链在线生成网站法拍重庆网站
  • 达州大亚网站建设网站建设佰金手指科杰十一
  • 自动化优化系统网站建设网站维护机构
  • 给公司做门户网站南宁网站建设建站系统
  • 做很多网站海南省建设注册中心网站
  • 深圳网站建设民治大道wordpress英文仿站教程
  • 江阴网站网站建设淘宝做网站推广人电话
  • wordpress 站群插件在dw上做网站首页导航栏
  • 网站建设上市wordpress模块化布局
  • 网站安全建设总结留言板 wordpress
  • 如何做好网站推广优化免费网站怎么做出来的
  • 行业网站做不下去wordpress做淘宝客可以加入api
  • 北京网站关键词优化推荐学做投资网站