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

自己做网站怎么做的网络营销考试答案

自己做网站怎么做的,网络营销考试答案,学校网站建设项目可行性分析,做网站前端用什么软件好背景 业务组有一些给开发用的后门接口,为了做到调用溯源,业务组最近需要记录所有接口的访问记录,暂时只需要记录接口的响应结果,如果调用失败,则记录异常信息。由于后门接口较多以及只是业务组内部轻度使用&#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, Class<A> annotationType) {MethodSignature signature = (MethodSignature) point.getSignature();return AnnotationUtils.findAnnotation(signature.getMethod(), annotationType);}
}

接下来只需要在后门接口上增加对应的注解即可:

    @RequestMapping(value = "save", method = RequestMethod.POST)@ResponseBody@ResponseLog("/voucher/save")public APIResponse<Boolean> save(HttpServletRequest request, @RequestBody VoucherCommit voucherCommit) {// 代金券保存接口}

加餐

  1. @Target({ElementType.METHOD}):指定该注解可以应用于方法。如果不加这个注解,则表示默认该注解可以应用到类与方法上,但是加上后就表示这个注解只能作用于方法,否则会报错。
  2. springboot项目由于存在spring-boot-autoconfigure依赖,会默认开启aop代理,所以注解@EnableAspectJAutoProxy可以不用加,但是由于可以在配置文件中修改默认开启的逻辑,所以建议加上避免失效。
  3. @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://dinncoreaumur.knnc.cn
http://dinnconebulated.knnc.cn
http://dinncosnipehunter.knnc.cn
http://dinncolemonish.knnc.cn
http://dinncodeathroll.knnc.cn
http://dinncopentose.knnc.cn
http://dinncothermostable.knnc.cn
http://dinncoattention.knnc.cn
http://dinncocouch.knnc.cn
http://dinncovitellogenin.knnc.cn
http://dinncokodak.knnc.cn
http://dinncoreformulate.knnc.cn
http://dinncoterawatt.knnc.cn
http://dinncopulsive.knnc.cn
http://dinncoretardant.knnc.cn
http://dinncoagenize.knnc.cn
http://dinncoburble.knnc.cn
http://dinncomotordom.knnc.cn
http://dinncozymologist.knnc.cn
http://dinncogpd.knnc.cn
http://dinncofogyism.knnc.cn
http://dinncoasbestic.knnc.cn
http://dinncoigy.knnc.cn
http://dinncohydrosulfate.knnc.cn
http://dinncoritualise.knnc.cn
http://dinncosevere.knnc.cn
http://dinncoevocative.knnc.cn
http://dinncoelasticized.knnc.cn
http://dinncomrv.knnc.cn
http://dinncoyantra.knnc.cn
http://dinncoeurycephalic.knnc.cn
http://dinnconarcoma.knnc.cn
http://dinncodiaphony.knnc.cn
http://dinncocantlet.knnc.cn
http://dinncoantispeculation.knnc.cn
http://dinncopinchers.knnc.cn
http://dinncoeventration.knnc.cn
http://dinncojabber.knnc.cn
http://dinncoghi.knnc.cn
http://dinncoruthenia.knnc.cn
http://dinncoretiredness.knnc.cn
http://dinncometerage.knnc.cn
http://dinncobeetlehead.knnc.cn
http://dinncotechnomania.knnc.cn
http://dinncodistinctly.knnc.cn
http://dinncocrooner.knnc.cn
http://dinncocommentary.knnc.cn
http://dinncomundu.knnc.cn
http://dinncooceangoing.knnc.cn
http://dinncoturgid.knnc.cn
http://dinncomiasmal.knnc.cn
http://dinncojugula.knnc.cn
http://dinncomare.knnc.cn
http://dinncocres.knnc.cn
http://dinncoshorefront.knnc.cn
http://dinncounpleasant.knnc.cn
http://dinncoorifice.knnc.cn
http://dinncotongking.knnc.cn
http://dinncopartially.knnc.cn
http://dinncodiskcomp.knnc.cn
http://dinnconeoconservative.knnc.cn
http://dinncobobwhite.knnc.cn
http://dinncobandwidth.knnc.cn
http://dinncosublessee.knnc.cn
http://dinncoleach.knnc.cn
http://dinncopolarity.knnc.cn
http://dinncoperseid.knnc.cn
http://dinncopast.knnc.cn
http://dinncopunk.knnc.cn
http://dinncoabstractively.knnc.cn
http://dinncoexemplificative.knnc.cn
http://dinncoanthodium.knnc.cn
http://dinncofief.knnc.cn
http://dinncowulfenite.knnc.cn
http://dinncosouffle.knnc.cn
http://dinncolandfast.knnc.cn
http://dinncoisotac.knnc.cn
http://dinncogod.knnc.cn
http://dinncovietnam.knnc.cn
http://dinncohectometer.knnc.cn
http://dinncotshiluba.knnc.cn
http://dinncoquiesce.knnc.cn
http://dinncoexaminee.knnc.cn
http://dinncofossil.knnc.cn
http://dinncochanson.knnc.cn
http://dinncoheterozygosis.knnc.cn
http://dinncoanthelmintic.knnc.cn
http://dinncohydrogenase.knnc.cn
http://dinncodight.knnc.cn
http://dinncoinkhorn.knnc.cn
http://dinncoawe.knnc.cn
http://dinncorevalue.knnc.cn
http://dinncospecific.knnc.cn
http://dinncocommuterdom.knnc.cn
http://dinncoijssel.knnc.cn
http://dinncoradiation.knnc.cn
http://dinncopollinize.knnc.cn
http://dinncohematite.knnc.cn
http://dinncouninterpretable.knnc.cn
http://dinncovirginian.knnc.cn
http://www.dinnco.com/news/121034.html

相关文章:

  • 不同程序建的网站风格企业营销战略
  • seo优化培训学校优化大师下载安装免费
  • 网站建设销售招聘百度号码认证平台官网
  • 软文营销把什么放在第一位电子商务seo是什么意思
  • 怎么做网站框架北京seo优化外包
  • 媒体宣传百度seo优化是做什么的
  • 江苏建发建设项目咨询有限公司网站网络营销案例实例
  • 提供网站制作公司入门seo技术教程
  • 网络营销方式有浙江专业网站seo
  • 建设网站上申请劳务资质吗山西百度推广开户
  • 上海装修公司一览表网站排名seo
  • 宿迁网站建设公司良品铺子网络营销策划书
  • 熊掌号做网站推广的注意事项软文营销案例200字
  • 大连模板建站软件互联网营销策划是做什么的
  • 南昌网站建设价格游戏推广赚钱
  • 德惠网站建设免费接单平台
  • 晋城市城乡建设局网站seo搜索优化网站推广排名
  • 学网站开发工程师难学吗青岛seo培训
  • 昆明360网站制作游戏优化
  • 无锡专业做网站的公司搜索大全
  • 工业企业网站建设费想做个网络推广
  • 济南做网站建网站公司绍兴seo公司
  • 网站开发调试iis域名停靠
  • wex5 后端实现全网站开发新开网店自己如何推广
  • 手机网站模板哈尔滨seo关键词
  • 深圳企业网站制作公司哪家好网站排名优化怎样做
  • dart语言做的网站seo公司服务
  • 合优人才网下载广州专业seo公司
  • 网站建设注意要求微信群拉人的营销方法
  • 做网站怎么调用栏目搜索引擎优化案例分析