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

网站建设需要用到什么wordpress横幅

网站建设需要用到什么,wordpress横幅,对网站建设过程,创网网络在上一篇文章中#xff0c;我提供了一个有关如何通过使用ProxyFactoryBean并实现MethodBeforeAdvice接口在Spring实现宽高比定向的简单示例。 在此示例中#xff0c;我们将学习如何通过使用Spring Boot和Aspect4j注释来实现方面方向。 让我们从gradle文件开始。 group com… 在上一篇文章中我提供了一个有关如何通过使用ProxyFactoryBean并实现MethodBeforeAdvice接口在Spring实现宽高比定向的简单示例。 在此示例中我们将学习如何通过使用Spring Boot和Aspect4j注释来实现方面方向。 让我们从gradle文件开始。 group com.gkatzioura version 1.0-SNAPSHOTapply plugin: java apply plugin: idea apply plugin: spring-bootsourceCompatibility 1.8buildscript {repositories {mavenCentral()}dependencies {classpath(org.springframework.boot:spring-boot-gradle-plugin:1.3.3.RELEASE)} }repositories {mavenCentral() }dependencies {compile(org.springframework.boot:spring-boot-starter-web) {exclude module: spring-boot-starter-tomcat}compile(org.springframework.boot:spring-boot-starter-jetty)compile(org.slf4j:slf4j-api:1.6.6)compile(ch.qos.logback:logback-classic:1.0.13)compile(org.aspectj:aspectjweaver:1.8.8)testCompile(junit:junit:4.11) } 除了Spring Boot插件外我们还必须包括AspectJweaver软件包。 应用类别 package com.gkatzioura.spring.aop;import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.ApplicationContext;/*** Created by gkatzioura on 5/28/16.*/ SpringBootApplication public class Application {public static void main(String[] args) {SpringApplication springApplication new SpringApplication();ApplicationContext applicationContext springApplication.run(Application.class,args);} } 我们将实现一项服务该服务将获取指定名称的示例。 样本模型将是一个简单的pojo package com.gkatzioura.spring.aop.model;/*** Created by gkatzioura on 5/28/16.*/ public class Sample {private String name;public String getName() {return name;}public void setName(String name) {this.name name;} } 该服务将创建一个示例对象。 package com.gkatzioura.spring.aop.service;import com.gkatzioura.spring.aop.model.Sample; import org.springframework.stereotype.Service;/*** Created by gkatzioura on 5/28/16.*/ Service public class SampleService {public Sample createSample(String sampleName) {Sample sample new Sample();sample.setName(sampleName);return sample;} } 到目前为止一切都很好。 假设我们要在创建样本之前和之后执行一些操作。 Spring的AOP可以帮助我们做到这一点。 createSample函数是一个JoinPoint。 主要概念是与建议一起使用。 根据文档建议是方面在特定的连接点处采取的措施。 在我们的例子中我们想在创建样本之前做一些额外的日志记录。 因此我们将使用之前建议类型。 package com.gkatzioura.spring.aop.aspect;import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Before; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component;/*** Created by gkatzioura on 5/28/16.*/ Aspect Component public class SampleServiceAspect {private static final Logger LOGGER LoggerFactory.getLogger(SampleServiceAspect.class);Before(execution(* com.gkatzioura.spring.aop.service.SampleService.createSample (java.lang.String)) args(sampleName))public void beforeSampleCreation(String sampleName) {LOGGER.info(A request was issued for a sample name: sampleName);}} 我们使用Before注释实现了一个函数。 我们提供给注解的参数是切入点表达式。 切入点表达式可帮助我们定义函数这将触发我们的建议和应使用的函数参数。 因此在执行createSample方法之前应该在屏幕上显示一条日志消息。 假设我们要在执行该方法之前和之后采取更多措施甚至更改createSample函数的结果我们可以使用Around Advice。 package com.gkatzioura.spring.aop.aspect;import com.gkatzioura.spring.aop.model.Sample; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Before; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component;/*** Created by gkatzioura on 5/28/16.*/ Aspect Component public class SampleServiceAspect {private static final Logger LOGGER LoggerFactory.getLogger(SampleServiceAspect.class);Before(execution(* com.gkatzioura.spring.aop.service.SampleService.createSample (java.lang.String)) args(sampleName))public void beforeSampleCreation(String sampleName) {LOGGER.info(A request was issued for a sample name: sampleName);}Around(execution(* com.gkatzioura.spring.aop.service.SampleService.createSample (java.lang.String)) args(sampleName))public Object aroundSampleCreation(ProceedingJoinPoint proceedingJoinPoint,String sampleName) throws Throwable {LOGGER.info(A request was issued for a sample name: sampleName);sampleName sampleName!;Sample sample (Sample) proceedingJoinPoint.proceed(new Object[] {sampleName});sample.setName(sample.getName().toUpperCase());return sample;}} 正如我们所看到的aroundSampleCreation建议一样更改输入并更改结果。 您可以在github上找到源代码 翻译自: https://www.javacodegeeks.com/2016/05/aspect-oriented-programming-spring-boot.html
http://www.zqtcl.cn/news/385850/

相关文章:

  • 北京自助模板建站遂宁企业网络推广方案
  • 湖南建设科技节能协会网站武夷山景区网站建设特点
  • 那些网站建设的好百度搜索风云排行榜
  • 网站开发 模板 c沈阳市建设工程质量检测中心网站
  • 企业网站设计专业好吗做钓鱼网站要具备什么
  • 广西备案工信部网站用asp.net做后台网站
  • 静态网站漏洞wordpress 外卖
  • 暗网做网站温州做网络推广的公司
  • 网站描述 修改上海火迎网络推广运营优化
  • 黄石网站建设哪家专业做个网站费用
  • 免费做的网站怎么设置域名解析宁夏百度seo
  • 化妆品产品的自建网站有哪些阿里云cdn wordpress错位
  • 增加网站流量网站新闻字体
  • 做外贸建网站需要推广吗服装如何做微商城网站
  • 上海市建设安全协会网站查询考试伪静态 wordpress
  • 网站免费建站o网站编程多少钱
  • 建设网站开发海外推广服务
  • 网站建设需要提供的资料文档营销平台建设
  • 做个响应式网站多少钱河南网络推广系统
  • wordpress的后台文章图文发布清远市seo广告优化
  • 长沙的互联网网站公司招标文件免费下载网站
  • icp备案系统网站品网站建设公司排名
  • 什么网站可以做音乐相册可信的品牌网站建设
  • 洛阳网站建设优惠公司网站查询ip地址
  • 学校网站模版电影网站要怎样做才有出路
  • 无锡网站建设 微信企业网站建设与管理期末考试
  • 海南海口网站开发公司怎么建立微网站?
  • 网站建设 鄂icp备app 微网站
  • 西安做网站seo网站站内优化怎么做
  • 建设网站方案公司wordpress 视差主题