在Java中,我可以使用org.reflections
来扫描包和搜索带注释的类。
像这样:
Reflections ref = new Reflections("my.path");
Set<Class<?>> set = ref.getTypesAnnotatedWith(MyAnnotation.class);
如何在scala中获取带注释的类?我使用scala 2.11
和scala-reflect
。
P.S。 org.reflections
在scala中运行良好,但我搜索原生乐器。