boommanpro / groovy-dynamic-loading

groovy动态加载java文件

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Java Dynamic loading

e.g.

    @Test
    public void createNewClassTest() throws Exception {
        ClassPathResource resource = new ClassPathResource("HelloWorldServiceImpl.java");
        GlueFactory glueFactory = GlueFactory.getInstance();
        HelloWorldService helloWorldService = glueFactory.loadNewInstance(IOUtils.toString(resource.getInputStream()), HelloWorldService.class);
        Assertions.assertEquals("java-glud", helloWorldService.sayHello());
    }

About

groovy动态加载java文件


Languages

Language:Java 100.0%