1.ApplicationContextHolder.getBean(类名.class)
Service service = ApplicationContextHolder.getBean(Service.class);
类中方法是static,等同于@Autowired 注入。(正常情况下@Autowired无法注入静态的bean)
2.Stopwatch:
Stopwatch stopwatch = Stopwatch.createStarted();
stopwatch.elapsed(TimeUnit.SECONDS)
相当于
long startTime=System.currentTimeMillis(); //获取开始时间
long endTime=System.currentTimeMillis(); //获取结束时间
System.out.println("程序运行时间: "+(endTime-startTime)+"ms");
3.compareTo
a.compareTo(b) ==> a>b 值为1, a=b 值为0, a<b 值为-1