Example usage for org.springframework.context.support ClassPathXmlApplicationContext getStartupDate

List of usage examples for org.springframework.context.support ClassPathXmlApplicationContext getStartupDate

Introduction

In this page you can find the example usage for org.springframework.context.support ClassPathXmlApplicationContext getStartupDate.

Prototype

@Override
public long getStartupDate() 

Source Link

Document

Return the timestamp (ms) when this context was first loaded.

Usage

From source file:boot.dubbo.normal.client.DemoConsumer.java

@Test
public void test() {
    ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(
            new String[] { "classpath:/META-INF/spring/applicationContext-dubbo.xml" });
    ctx.start();/* w w  w . j a v  a  2  s.  c  o  m*/

    System.out.println(ctx.getStartupDate());
    UserService userService = ctx.getBean("userService", UserService.class);
    while (true) {
        List<User> users = userService.findAll();
        User u = new User();
        Random r = new Random();
        u.setName("gsadg" + r.nextInt());
        String v = userService.create(u);
        System.out.println("" + v + "size:" + users.size());
        try {
            Thread.sleep(100);
        } catch (InterruptedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

    // try {
    // System.in.read();
    // } catch (IOException e) {
    // e.printStackTrace();
    // }
}