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

网站的竞品分析怎么做沧州百度推广公司

网站的竞品分析怎么做,沧州百度推广公司,宏发建设有限公司网站,管网建设是什么意思目录 半注解形式: 业务层接口实现类: 编写切面类: 在配置文件里面唯一需要加的: 测试类: 全注解形式: 不要配置文件,改为配置类: 同样的业务层接口实现类: 同样的…

目录

半注解形式:

业务层接口+实现类:

编写切面类:

在配置文件里面唯一需要加的:

测试类:

全注解形式:

不要配置文件,改为配置类:

同样的业务层接口+实现类:

同样的自定义切面类:

测试类改为不加载配置文件加载配置类:


半注解形式:

业务层接口+实现类:

public interface UserService {public void save();
}@Service
public class UserServiceImpl implements UserService {//保存方法
//    @Overridepublic void save() {System.out.println("业务层方法执行了!!!");//int i=5/0;}
}

编写切面类:

/*** @Component  // 把该类交给IOC去管理* @Aspect     // 声明是切面类  == <aop:aspect ref="myXmlAspect">*/
@Component
@Aspect
public class MyAnnoAspect {/*** 通知的方法*/// @Before(value = "切入点的表达式")@Before("execution(public void com.qcby.demo1.UserServiceImpl.save())")public void log(){System.out.println("前置方法执行了!!");}
}

在配置文件里面唯一需要加的:

1、开启注解扫描:

2、开启aop自动代理:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:context="http://www.springframework.org/schema/context"xmlns:aop="http://www.springframework.org/schema/aop"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsdhttp://www.springframework.org/schema/contexthttp://www.springframework.org/schema/context/spring-context.xsdhttp://www.springframework.org/schema/aophttp://www.springframework.org/schema/aop/spring-aop.xsd"><!--开启注解扫描 扫描所有被spring管理的类--><context:component-scan base-package="com.qcby"/><!--开启AOP注解支持--><aop:aspectj-autoproxy/>
</beans>

测试类:

/*** 测试类* 测试AOP的增强* @RunWith(SpringJUnit4ClassRunner.class)  声明为测试单元* @ContextConfiguration("classpath:applicationContext.xml")  加载配置文件*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:applicationContext.xml")
public class TestDemo1 {@Autowiredprivate UserService userService;@Testpublic void run(){userService.save();}
}

运行结果:

全注解形式:

不要配置文件,改为配置类:

@Configuration // 配置类
@ComponentScan(value = "com.qcby") // 扫描包
@EnableAspectJAutoProxy // 开启自动代理 == <aop:aspectj-autoproxy />
public class SpringConfig {
}

同样的业务层接口+实现类:

public interface UserService {public void save();
}@Service
public class UserServiceImpl implements UserService {//保存方法
//    @Overridepublic void save() {System.out.println("业务层方法执行了!!!");//int i=5/0;}
}

同样的自定义切面类:

/*** @Component  // 把该类交给IOC去管理* @Aspect     // 声明是切面类  == <aop:aspect ref="myXmlAspect">*/
@Component
@Aspect
public class MyAnnoAspect {/*** 通知的方法*/// @Before(value = "切入点的表达式")@Before("execution(public void com.qcby.demo1.UserServiceImpl.save())")public void log(){System.out.println("前置方法执行了!!");}
}

测试类改为不加载配置文件加载配置类:

/*** 测试类* 测试AOP的增强* @RunWith(SpringJUnit4ClassRunner.class)  声明为测试单元* @ContextConfiguration("classpath:applicationContext.xml")  加载配置文件*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = SpringConfig.class)
public class TestDemo1 {@Autowiredprivate UserService userService;@Testpublic void run(){userService.save();}
}

运行结果:

http://www.mnyf.cn/news/32991.html

相关文章:

  • wordpress 链接本地化seo关键词排名系统
  • 可以直接做海报的网站最近新闻头条最新消息
  • 建站公司外包现在最火的推广平台
  • 北京计算机培训机构前十名佛山网站建设十年乐云seo
  • 网站需要写哪些内容吗一站传媒seo优化
  • html5标准网站建设网页设计个人主页
  • 金属建材企业网站建设方案seo平台怎么样
  • 太原建设银行网站网站维护费用一般多少钱
  • 卡通做头像的网站鹤壁搜索引擎优化
  • 网站维护运营品牌seo是什么意思
  • wordpress 小米模板下载班级优化大师app
  • 网站设计评价cpu优化软件
  • 兰州网站优化seo中国疾控卫生应急服装
  • 家乡网站建设策划案网络营销策略有哪些
  • 圣玺企业网站建设营销方案100例
  • 门户网站底部seo外包 靠谱
  • 不重名的建筑公司名字seo搜索优化费用
  • 泰安网站建设公司带网站开发的一般流程
  • 网站设计 中高端广告策划案优秀案例
  • 养殖场在哪个网站做环评备案百度手机助手app安卓版官方下载
  • 平原做网站淘宝关键词排名怎么查
  • wordpress the7 官网苏州关键词seo排名
  • 网站仿静态和静态的区别优化资讯
  • 做网站不会P图怎么办网页设计主题参考
  • 官方网站建设的意义河池网站seo
  • wordpress 访问权限属于seo网站优化
  • 高淳做网站价格全网关键词搜索
  • 学校网站系统破解版免费html网站模板
  • 广州网站制作功能免费的网页制作软件
  • 新手学做网站教程网站友情链接购买