1.前置通知(BeforeAdvice):

  1. import java.lang.reflect.Method;
  2.  
  3. import org.springframework.aop.MethodBeforeAdvice;
  4.  
  5. public class HelloBeforeAdvice implements MethodBeforeAdvice{
  6.  
  7. public void before(Method method, Object[] args, Object target) throws Throwable {
  8. System.out.println("do something before some method");
  9. }
  10. }

如果出现 The hierarchy of the type HelloBeforeAdvice is inconsistent错误 , 是缺少相关的jar或者jdk环境不对。

2.后置通知(AfterAdvice)

  1. import java.lang.reflect.Method;
  2.  
  3. import org.springframework.aop.AfterReturningAdvice;
  4.  
  5. public class HelloAfterAdvice implements AfterReturningAdvice {
  6.  
  7. public void afterReturning(Object result, Method method, Object[] args, Object target) throws Throwable {
  8. System.out.println("do something after the method");
  9. }
  10.  
  11. }

3. Test client

  1. import org.springframework.aop.framework.ProxyFactory;
  2.  
  3. public class TestClient {
  4.  
  5. public static void main(String[] args) {
  6. ProxyFactory proxyFactory = new ProxyFactory();//创建代理工厂
  7. proxyFactory.setTarget(new HelloImpl());
  8. proxyFactory.addAdvice(new HelloBeforeAdvice());
  9. proxyFactory.addAdvice(new HelloAfterAdvice());
  10. Hello helloProxy = (Hello) proxyFactory.getProxy();
  11. System.out.println(helloProxy.sayHello("zhangsan"));
  12. }
  13. }
  14.  
  15. ----------------------------
    public class HelloImpl implements Hello {
  16.  
  17.     public String sayHello(String str) {
            System.out.println("hello>>>"+str);
            return "hello>>>"+str;
        }
    }

4. 环绕通知(AroundAdvice)

  1. //aop联盟提供的接口
  2. import org.aopalliance.intercept.MethodInterceptor;
  3. import org.aopalliance.intercept.MethodInvocation;
  4.  
  5. public class HelloAroundAdvice implements MethodInterceptor {
  6.  
  7. public Object invoke(MethodInvocation invocation) throws Throwable {
  8. System.out.println("before method>>>");
  9. Object result = invocation.proceed();
  10. System.out.println("after method>>");
  11. return result;
  12. }
  13. }

5. spring 配置文件方式

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
  4. xmlns:tx="http://www.springframework.org/schema/tx" xmlns:p="http://www.springframework.org/schema/p"
  5. xmlns:util="http://www.springframework.org/schema/util" xmlns:jdbc="http://www.springframework.org/schema/jdbc"
  6. xmlns:cache="http://www.springframework.org/schema/cache"
  7. xsi:schemaLocation="
  8. http://www.springframework.org/schema/context
  9. http://www.springframework.org/schema/context/spring-context.xsd
  10. http://www.springframework.org/schema/beans
  11. http://www.springframework.org/schema/beans/spring-beans.xsd
  12. http://www.springframework.org/schema/tx
  13. http://www.springframework.org/schema/tx/spring-tx.xsd
  14. http://www.springframework.org/schema/jdbc
  15. http://www.springframework.org/schema/jdbc/spring-jdbc.xsd
  16. http://www.springframework.org/schema/cache
  17. http://www.springframework.org/schema/cache/spring-cache.xsd
  18. http://www.springframework.org/schema/aop
  19. http://www.springframework.org/schema/aop/spring-aop.xsd
  20. http://www.springframework.org/schema/util
  21. http://www.springframework.org/schema/util/spring-util.xsd">
  22. <!-- 自动扫描ppms包 ,将带有注解的类 纳入spring容器管理 -->
  23. <context:component-scan base-package="com.cdv.ppms"></context:component-scan>
  24.  
  25. <bean id="helloProxy" class="org.springframework.aop.framework.ProxyFactoryBean">
  26. <property name="interfaces" value="com.cdv.ppms.Hello"/><!-- 需要代理的接口 -->
  27. <property name="target" ref="helloImpl"/><!-- 接口实现类 , 此处需要是ref 否则object is not an instance of declaring class-->
  28. <property name="interceptorNames"><!-- 拦截器 名称-->
  29. <list>
  30. <value>helloAroundAdvice</value>
  31. </list>
  32. </property>
  33. </bean>
  34.    <bean id="helloImpl" class="com.cdv.ppms.HelloImpl"></bean>
  35. </beans>
  1. import org.springframework.stereotype.Component;
  2.  
  3. @Component
  4. public class HelloImpl implements Hello {
  5. //...
  6. }
  7.  
  8. @Component
  9. public class HelloAroundAdvice implements MethodInterceptor {
  10. //....
  11. }
  1. import org.springframework.context.ApplicationContext;
  2. import org.springframework.context.support.ClassPathXmlApplicationContext;
  3.  
  4. public class TestXMLClient {
  5.  
  6. public static void main(String[] args) {
  7. ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
  8. Hello hello = (Hello) context.getBean("helloProxy");
  9. hello.sayHello("test xml");
  10. }
  11. }

6. 抛出通知(ThrowAdvice)

  1. import java.lang.reflect.Method;
  2. import org.springframework.aop.ThrowsAdvice;
  3. import org.springframework.stereotype.Component;
  4.  
  5. @Component
  6. public class HelloThrowAdvice implements ThrowsAdvice{
  7. public void afterThrowing(Method method, Object[] args, Object target, Exception e){
  8. System.out.println("-------------------Throw Exception------------------------");
  9. System.out.println("target class>>"+target.getClass().getName());
  10. System.out.println("method class>>" + method.getName());
  11. System.out.println("exception message>>"+e.getMessage());
  12. System.out.println("-------------------Throw Exception------------------------");
  13. }
  14. }
  1. <bean id="helloProxy" class="org.springframework.aop.framework.ProxyFactoryBean">
  2. <property name="interfaces" value="com.cdv.ppms.Hello"/><!-- 需要代理的接口 -->
  3. <property name="target" ref="helloImpl"/><!-- 接口实现类 -->
  4. <property name="interceptorNames"><!-- 拦截器 名称-->
  5. <list>
  6. <value>helloAroundAdvice</value>
  7. <value>testThrowAdvice</value>
  8. </list>
  9. </property>
  10. </bean>
  1. import org.springframework.stereotype.Component;
  2.  
  3. @Component
  4. public class HelloImpl implements Hello {
  5.  
  6. public String sayHello(String str) {
  7. System.out.println("hello>>>"+str);
  8. throw new RuntimeException("error>>");//加入异常以便测试
  9. }
  10. }

7. 引入通知(Introduction Advice)

对方法的增强叫织入(Weaving),对类的增强叫引入(Introduction)

  1. import org.aopalliance.intercept.MethodInvocation;
  2. import org.springframework.aop.support.DelegatingIntroductionInterceptor;
  3. import org.springframework.stereotype.Component;
  4. @Component
  5. public class HelloIntroAdvice extends DelegatingIntroductionInterceptor implements Apology {
  6.  
  7. /**
  8. *
  9. */
  10. private static final long serialVersionUID = -3328637206414010549L;
  11.  
  12. public Object invoke(MethodInvocation invocation) throws Throwable{
  13.  
  14. return super.invoke(invocation);
  15. }
  16.  
  17. public void saySorry(String str) {
  18. System.out.println("introduction advice>>>"+str);
  19. }
  20. }
  1. <bean id="helloProxy" class="org.springframework.aop.framework.ProxyFactoryBean">
  2. <property name="interfaces" value="com.cdv.ppms.Apology"/><!-- 需要代理的接口 -->
  3. <property name="target" ref="helloImpl"/><!-- 接口实现类 -->
  4. <property name="interceptorNames"><!-- 拦截器 名称-->
  5. <list>
  6. <value>helloAroundAdvice</value>
  7. <value>helloThrowAdvice</value>
  8. <value>helloIntroAdvice</value>
  9. </list>
  10. </property>
  11. <property name="proxyTargetClass" value="true"></property><!--代理目标类, 默认false代理接口-->
  12. </bean>
  13. <bean id="helloImpl" class="com.cdv.ppms.HelloImpl"></bean>
  1. import org.springframework.context.ApplicationContext;
  2. import org.springframework.context.support.ClassPathXmlApplicationContext;
  3.  
  4. public class TestXMLClient {
  5.  
  6. public static void main(String[] args) {
  7. ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
  8. HelloImpl helloImpl = (HelloImpl) context.getBean("helloProxy");
  9. helloImpl.sayHello("test xml");
  10. Apology apology = (Apology) helloImpl;//将目标类向上强制转型为Apology接口, 这时引入通知给我们带来的特性, 也就是“接口动态实现”功能
  11. apology.saySorry("zhangsan");
  12. }
  13. }

8. 切面(Advisor)

切面(Advisor)封装了通知(Advice)和切点(Pointcut)

  1. import org.springframework.stereotype.Component;
  2.  
  3. @Component
  4. public class HelloImpl implements Hello {
  5.  
  6. public String sayHello(String str) {
  7. System.out.println("hello>>>"+str);
  8. return str;
  9. }
  10.  
  11. public void advisorOne(String name){
  12. System.out.println("advisor one>>>"+name);
  13. }
  14.  
  15. public void advisorTwo(String name){
  16. System.out.println("advisor two>>"+name);
  17. }
  18. }

在代理类中新增以advisor开头的方法,对其进行拦截

  1. <context:component-scan base-package="com.cdv.ppms"></context:component-scan>
  2.     <!--定义切面-->
  3. <bean id="helloAdvisor" class="org.springframework.aop.support.RegexpMethodPointcutAdvisor">
  4. <property name="advice" ref="helloAroundAdvice"/>
  5. <property name="pattern" value="com.cdv.ppms.HelloImpl.advisor.*"></property><!-- 切点 (正则表达式) -->
  6. </bean>
  7. <bean id="helloProxy" class="org.springframework.aop.framework.ProxyFactoryBean">
  8. <property name="target" ref="helloImpl"/><!-- 接口实现类 -->
  9. <property name="interceptorNames" value="helloAdvisor"/>
  10. <property name="proxyTargetClass" value="true"></property>
  11. </bean>
  12. <bean id="helloImpl" class="com.cdv.ppms.HelloImpl"></bean>
  13. <bean id="helloAroundAdvice" class="com.cdv.ppms.HelloAroundAdvice"></bean>
  1. import org.aopalliance.intercept.MethodInterceptor;
  2. import org.aopalliance.intercept.MethodInvocation;
  3. import org.springframework.stereotype.Component;
  4. @Component
  5. public class HelloAroundAdvice implements MethodInterceptor {
  6.  
  7. public Object invoke(MethodInvocation invocation) throws Throwable {
  8. System.out.println("before method>>>");
  9. Object result = invocation.proceed();
  10. System.out.println("after method>>");
  11. return result;
  12. }
  13. }
  1. import org.springframework.context.ApplicationContext;
  2. import org.springframework.context.support.ClassPathXmlApplicationContext;
  3.  
  4. public class TestXMLClient {
  5.  
  6. public static void main(String[] args) {
  7. ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
  8. HelloImpl helloImpl = (HelloImpl) context.getBean("helloProxy");
  9. helloImpl.advisorOne("11111111");
  10. helloImpl.advisorTwo("2222222222");
  11.  
  12. }
  13. }
  14. -------------around包了两层, 有问题-------------------------------------------
  15. before method>>>
  16. before method>>>
  17. advisor one>>>11111111
  18. after method>>
  19. after method>>
  20. before method>>>
  21. before method>>>
  22. advisor two>>2222222222
  23. after method>>
  24. after method>>
  25. ------------------------

随着项目的扩大, 上述的代理配置会越来越多。

9. 自动代理(扫描bean名称)

定义BeanNameAutoProxyCreator,该bean是个bean后处理器,无需被引用,因此没有id属性

  1. <context:component-scan base-package="com.cdv.ppms"></context:component-scan>
  2.  
  3. <bean class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
  4. <property name="beanNames" value="*Impl"/><!--对以Impl结尾的类进行处理-->
  5. <property name="interceptorNames" value="helloAroundAdvice"/>
  6. <property name="optimize" value="true"/>
  7. </bean>
  8.  
  9. <bean id="helloImpl" class="com.cdv.ppms.HelloImpl"></bean>
  10. <bean id="helloAroundAdvice" class="com.cdv.ppms.HelloAroundAdvice"></bean>

测试

  1. import org.springframework.context.ApplicationContext;
  2. import org.springframework.context.support.ClassPathXmlApplicationContext;
  3.  
  4. public class TestXMLClient {
  5.  
  6. public static void main(String[] args) {
  7. ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
  8. HelloImpl helloImpl = (HelloImpl) context.getBean("helloImpl");
  9. helloImpl.advisorOne("11111111");//
  10. helloImpl.advisorTwo("2222222222");
  11. helloImpl.sayHello("zhangwuji");
  12. }
  13. }

10. 自动代理(扫描切面配置)

代理将由DefaultAdvisorAutoProxyCreator自动生成,这个类可以扫描所有的切面类

  1. <context:component-scan base-package="com.cdv.ppms"></context:component-scan>
  2. <bean id="helloAdvisor" class="org.springframework.aop.support.RegexpMethodPointcutAdvisor">
  3. <property name="advice" ref="helloAroundAdvice"/>
  4. <property name="pattern" value="com.cdv.ppms.HelloImpl.advisor.*"/>
  5. </bean>
  6. <bean class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator">
  7. <property name="optimize" value="true"/>
  8. </bean>
  9. <bean id="helloImpl" class="com.cdv.ppms.HelloImpl"></bean>
  10. <bean id="helloAroundAdvice" class="com.cdv.ppms.HelloAroundAdvice"></bean>

测试

  1. import org.springframework.context.ApplicationContext;
  2. import org.springframework.context.support.ClassPathXmlApplicationContext;
  3.  
  4. public class TestXMLClient {
  5.  
  6. public static void main(String[] args) {
  7. ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
  8. HelloImpl helloImpl = (HelloImpl) context.getBean("helloImpl");
  9. helloImpl.advisorOne("11111111");
  10. helloImpl.advisorTwo("2222222222");
  11. helloImpl.sayHello("zhangwuji");
  12. }
  13. }
  14. //只有符合advisor开头的方法才会被代理

这样在spring的配置中会存在大量的切面配置(想拦截指定注解的方法,就必须拓展DefaultPointcutAdvisor类,自定义一个切面类)。

11. Spring & AspectJ

11-1 基于注解 :通过execution()表达式 拦截方法

  1. import org.aspectj.lang.ProceedingJoinPoint;
  2. import org.aspectj.lang.annotation.Around;
  3. import org.aspectj.lang.annotation.Aspect;
  4. import org.springframework.stereotype.Component;
  5.  
  6. @Aspect
  7. @Component
  8. public class HelloAspect {
  9.  
  10. @Around("execution(* com.cdv.ppms.HelloImpl.*(..))")//切点表达式
  11. public Object around(ProceedingJoinPoint pjp) throws Throwable{
  12. before();
  13. Object result = pjp.proceed();
  14. after();
  15. return result;
  16. }
  17.  
  18. private void after() {
  19. System.out.println("hey,, after.");
  20.  
  21. }
  22.  
  23. private void before() {
  24. System.out.println("hey,, before");
  25. }
  26. }

切点表达式

execution()表示拦截的方法, 挂号中定义拦截的规则

上面第一个*表示返回任意类型

第二个*表示HelloImpl类中的任意方法

..表示任意类型参数

  1. <context:component-scan base-package="com.cdv.ppms"></context:component-scan>
  2. <aop:aspectj-autoproxy proxy-target-class="true"/><!-- 默认值为false只能代理接口,当为true时才能代理目标类 -->
  3. <bean id="helloImpl" class="com.cdv.ppms.HelloImpl"></bean>

test

  1. import org.springframework.context.ApplicationContext;
  2. import org.springframework.context.support.ClassPathXmlApplicationContext;
  3.  
  4. public class TestXMLClient {
  5.  
  6. public static void main(String[] args) {
  7. ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
  8. HelloImpl helloImpl = (HelloImpl) context.getBean("helloImpl");
  9. helloImpl.advisorOne("11111111");
  10. helloImpl.advisorTwo("2222222222");
  11. helloImpl.sayHello("zhangwuji");
  12. }
  13. }

11-2 基于注解 通过AspectJ @annotation表达式拦截方法

自定义注解

  1. import java.lang.annotation.ElementType;
  2. import java.lang.annotation.Retention;
  3. import java.lang.annotation.RetentionPolicy;
  4. import java.lang.annotation.Target;
  5.  
  6. @Target(ElementType.METHOD)
  7. @Retention(RetentionPolicy.RUNTIME)
  8. public @interface MyTag {
  9.  
  10. }

更改aspect类的切点表达式

  1. import org.aspectj.lang.ProceedingJoinPoint;
  2. import org.aspectj.lang.annotation.Around;
  3. import org.aspectj.lang.annotation.Aspect;
  4. import org.springframework.stereotype.Component;
  5.  
  6. @Aspect
  7. @Component
  8. public class HelloAspect {
  9.  
  10. @Around("@annotation(com.cdv.ppms.MyTag)")
  11. public Object around(ProceedingJoinPoint pjp) throws Throwable{
  12. before();
  13. Object result = pjp.proceed();
  14. after();
  15. return result;
  16. }
  17.  
  18. private void after() {
  19. System.out.println("hey,, after.");
  20.  
  21. }
  22.  
  23. private void before() {
  24. System.out.println("hey,, before");
  25. }
  26. }

该注解可以标注在方法上,运行时生效

  1. import org.springframework.stereotype.Component;
  2.  
  3. @Component
  4. public class HelloImpl implements Hello {
  5.  
  6. public String sayHello(String str) {
  7. System.out.println("hello>>>"+str);
  8. return str;
  9. }
  10. @MyTag
  11. public void advisorOne(String name){
  12. System.out.println("advisor one>>>"+name);
  13. }
  14. public void advisorTwo(String name){
  15. System.out.println("advisor two>>"+name);
  16. }
  17. }

配置

  1. <context:component-scan base-package="com.cdv.ppms"></context:component-scan>
  2. <bean id="helloImpl" class="com.cdv.ppms.HelloImpl"></bean>

测试

  1. import org.springframework.context.ApplicationContext;
  2. import org.springframework.context.support.ClassPathXmlApplicationContext;
  3.  
  4. public class TestXMLClient {
  5.  
  6. public static void main(String[] args) {
  7. ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
  8. HelloImpl helloImpl = (HelloImpl) context.getBean("helloImpl");
  9. helloImpl.advisorOne("11111111");
  10. helloImpl.advisorTwo("2222222222");
  11. helloImpl.sayHello("zhangwuji");
  12. }
  13. }

其他几个注解

@Before  @After  @AfterThrowing @DeclareParents引入通知 AfterReturning(返回后通知,在方法结束后执行)

11-3 引入通知

Aspect类

  1. import org.aspectj.lang.annotation.Aspect;
  2. import org.aspectj.lang.annotation.DeclareParents;
  3. import org.springframework.stereotype.Component;
  4.  
  5. @Aspect
  6. @Component
  7. public class HelloAspect {
  8.     //something need to do
  9. @DeclareParents(value="com.cdv.ppms.HelloImpl",defaultImpl=com.cdv.ppms.ApologyImpl.class)
  10. private Apology apology;
  11.  
  12. }

接口实现类

  1. public class ApologyImpl implements Apology {
  2.  
  3. public void saySorry(String str) {
  4. System.out.println("apologyImpl>>>"+str);
  5. }
  6. }

配置

  1. <context:component-scan base-package="com.cdv.ppms"></context:component-scan>
  2. <bean id="helloImpl" class="com.cdv.ppms.HelloImpl"></bean>

测试

  1. import org.springframework.context.ApplicationContext;
  2. import org.springframework.context.support.ClassPathXmlApplicationContext;
  3.  
  4. public class TestXMLClient {
  5.  
  6. public static void main(String[] args) {
  7. ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
  8. HelloImpl helloImpl = (HelloImpl) context.getBean("helloImpl");
  9. helloImpl.sayHello("zhangwuji");
  10. Apology apology = (Apology) helloImpl;
  11. apology.saySorry("hahahahah");
  12. }
  13. }

spring aop advice的更多相关文章

  1. spring AOP advice 类型 和 通用的切点的配置方式

    spring aop advice的类型: 1.前置通知(before advice) 2.返回后通知(after returning advice) 3.抛出异常后通知(after throwing ...

  2. Spring AOP Example – Advice

    Spring AOP + AspectJ Using AspectJ is more flexible and powerful. Spring AOP (Aspect-oriented progra ...

  3. Spring AOP Example – Pointcut , Advisor

    In last Spring AOP advice examples, the entire methods of a class are intercepted automatically. But ...

  4. 框架源码系列三:手写Spring AOP(AOP分析、AOP概念学习、切面实现、织入实现)

    一.AOP分析 问题1:AOP是什么? Aspect Oriented Programming 面向切面编程,在不改变类的代码的情况下,对类方法进行功能增强. 问题2:我们需要做什么? 在我们的框架中 ...

  5. Spring -- aop(面向切面编程),前置&后置&环绕&抛异常通知,引入通知,自动代理

    1.概要 aop:面向方面编程.不改变源代码,还为类增加新的功能.(代理) 切面:实现的交叉功能. 通知:切面的实际实现(通知要做什么,怎么做). 连接点:应用程序执行过程期间,可以插入切面的地点. ...

  6. Spring Aop(十四)——Aop自动创建代理对象的原理

    转发地址:https://www.iteye.com/blog/elim-2398725 Aop自动创建代理对象的原理 我们在使用Spring Aop时,通常Spring会自动为我们创建目标bean的 ...

  7. Spring Aop(十)——编程式的Pointcut

    转发地址:https://www.iteye.com/blog/elim-2396526 编程式的Pointcut 除了可以通过注解和Xml配置定义Pointcut之外,其实我们还可以通过程序来定义P ...

  8. Spring Aop(九)——基于正则表达式的Pointcut

    转发地址:https://www.iteye.com/blog/elim-2396525 基于正则表达式的Pointcut JdkRegexpMethodPointcut Spring官方为我们提供了 ...

  9. Spring Aop(八)——advisor标签

    转发地址:https://www.iteye.com/blog/elim-2396274 8 advisor标签 advisor标签是需要定义在aspect标签里面的,其作用与aspect类似,可以简 ...

随机推荐

  1. smdkv210

    参考:http://code.google.com/p/libyuv/issues/detail?id=295 ******************************************** ...

  2. A successful Git branching model

    这个模型比较全,收藏一下,原文: http://nvie.com/posts/a-successful-git-branching-model/ 关于这个模型中的hotfix只适应最新的Release ...

  3. C# 开发者代码审查清单【转】

    这是为C#开发者准备的通用性代码审查清单,可以当做开发过程中的参考.这是为了确保在编码过程中,大部分通用编码指导原则都能注意到.对于新手和缺乏经验(0到3年工作经验)的开发者,参考这份清单编码会很帮助 ...

  4. 使用UIKit制作卡牌游戏(一)ios游戏篇

    转自朋友Tommy 的翻译,自己只翻译了第三篇教程. 译者: Tommy | 原文作者: Matthijs Hollemans写于2012/06/29 原文地址: http://www.raywend ...

  5. 64bit ubuntu 安装32bit的软件

    在64bit的系统上安装32bit的软件时,会提示: file not found or no such file. 此时只需要安装 sudo apt-get install libc6-dev-i3 ...

  6. Legolas工业自动化平台入门(一)搭建应用

    前两篇给大家介绍了TWaver家族的新面孔--Legolas工业自动化平台,通过两个应用案例钻井平台工程用车和水源地监控系统,相信大家对Legolas已经有了一定程度的了解.这几篇文章,我们会逐步介绍 ...

  7. IBM X3650 M4服务器安装centos找不到硬盘的解决方法

    IBM X3650 M4是IBM新的2U的服务器,IBM服务器以高稳定性和卓越的性能一直领先其他的服务器品牌成为全球第一.但是我们在用IBM的最新版9.4引导盘引导的时候,里面选项只有windows ...

  8. left join on

    问题: select * from A left join  f on e.cust=f.account_id where f.status='0' 与 select * from A left jo ...

  9. DalekJS – 基于 JavaScript 实现跨浏览器的自动化测试

    在 Web 项目中,浏览器兼容以及跨浏览器测试是最重要的也是最费劲的工作.DalekJS 是一个基于 JavaScript(或 Node.js) 的免费和开源的自动化测试接口.它能够同时运行测试一组流 ...

  10. [C] static和extern的作用

    static: 当用于函数定义或者代码块之外的变量声明时,static关键字用于修改标识符的链接属性,从external改为internal. 当用于代码块内部的变量声明时,static关键字用于修改 ...