Я запускаю этот код в junit-тест. Однако аннотации не найдены, и ничего не выводится. Что может быть причиной этого.Аннотации не найдены во время цикла
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
public @interface Datafield {
}
public class EntityTest
{
@Datafield
StandardFieldText username;
@Test
public void TestEntityAnnotation() throws NoSuchFieldException, SecurityException
{
EntityTest et = new EntityTest();
Annotation[] annos = et.getClass().getAnnotations();
for(Annotation a : annos)
System.out.println(a);
}
}
проверить импорт! – alfasin