dimanche 11 septembre 2016

Get class object by annotation field in Java reflection or spring

Class.forname can get the class object by name of the java class. Here, I want to give the class an alias by annotation. For example

@Component("foo")
class Foo {
    private String id;
}

How to get the Foo Class with the annotation field String "foo" in java reflection or using Spring?





Aucun commentaire:

Enregistrer un commentaire