Create an instance a Bean
import java.beans.Beans; import java.io.Serializable; public class Main implements Serializable { private Long id; private String name; public Main() { } public static void main(String[] args) throws Exception { Main bean = (Main) Beans.instantiate(ClassLoader.getSystemClassLoader(), "Main"); System.out.println("The Bean = " + bean); } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } @Override public String toString() { return "[id=" + id + "; name=" + name + "]"; } }