2
    public class Test{
            public static void say(String hello){
                 System.out.println(hello);
            }
     }

Class Test has a static method 'say', how can I intercept this static method? Is there a way to work by using InvocationHandler?

Thanks in advance

Sstx
  • 604
  • 1
  • 8
  • 21
  • Like this? http://stackoverflow.com/questions/4993947/how-to-intercept-static-methods-in-spring – Smutje Nov 10 '14 at 09:24
  • possible duplicate of [How do I intercept a method invocation with standard java features (no AspectJ etc)?](http://stackoverflow.com/questions/576918/how-do-i-intercept-a-method-invocation-with-standard-java-features-no-aspectj-e) – specializt Nov 10 '14 at 09:25
  • If you want to use it for unit-tests, only, maybe you want to use a mocking-framework that can mock static methods like _jmockit_ (you can also intercept them that way, although this is not the main goal of those frameworks). However, only suitable for tests. – Andy Nov 10 '14 at 09:28

0 Answers0