package com.lhstack; import java.lang.reflect.Method; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class TemplateApplication { public static void main(String[] args) { try { // Class classes = Class.forName("com.lhstack.Test"); // Class classes = Test.class; Test test = new Test(); Class classes = test.getClass(); String methodName = "hello"; Class paratype[] = new Class[1]; paratype[0]=String.class; Method method = classes.getDeclaredMethod(methodName, paratype); method.invoke(classes.newInstance(), "testcj222m1"); System.err.println("++++++++++++++++++"); } catch (Exception e) { // TODO: handle exception } SpringApplication.run(TemplateApplication.class, args); } }