use of act.inject.genie.GenieInjector in project actframework by actframework.
the class App method hasSingletonAnnotation.
private boolean hasSingletonAnnotation(Class<?> cls) {
boolean found = false;
GenieInjector injector = Act.app().injector();
Annotation[] aa = cls.getAnnotations();
for (Annotation a : aa) {
Class<? extends Annotation> type = a.annotationType();
if (injector.isInheritedScopeStopper(type)) {
return false;
}
if (InheritedStateless.class == type || Stateless.class == type || Singleton.class == type) {
found = true;
}
}
return found;
}
use of act.inject.genie.GenieInjector in project actframework by actframework.
the class App method registerMetricProvider.
private void registerMetricProvider() {
GenieInjector gi = this.injector();
MetricProvider mp = new MetricProvider();
gi.registerNamedProvider(Metric.class, mp);
gi.registerProvider(Metric.class, mp);
}
use of act.inject.genie.GenieInjector in project actframework by actframework.
the class AutoConfigPluginTest method before.
@Before
public void before() throws Exception {
setup();
resolverManager = new StringValueResolverManager(mockApp);
when(mockApp.resolverManager()).thenReturn(resolverManager);
injector = new GenieInjector(mockApp);
when(mockApp.injector()).thenReturn(injector);
GenericPluginManager pluginManager = mock(GenericPluginManager.class);
Field field = Act.class.getDeclaredField("pluginManager");
field.setAccessible(true);
field.set(null, pluginManager);
when(mockAppConfig.getIgnoreCase(argThat(new ContainsIgnoreCase(".int")))).thenReturn(intVal);
when(mockAppConfig.getIgnoreCase(argThat(new ContainsIgnoreCase(".long")))).thenReturn(longVal);
when(mockAppConfig.getIgnoreCase(argThat(new ContainsIgnoreCase(".bool")))).thenReturn(boolVal);
when(mockAppConfig.getIgnoreCase(argThat(new ContainsIgnoreCase(".str")))).thenReturn(stringVal);
when(mockAppConfig.getIgnoreCase(argThat(new ContainsIgnoreCase(".method")))).thenReturn(enumVal);
when(mockAppConfig.getIgnoreCase(argThat(new ContainsIgnoreCase(".list")))).thenReturn(intListVal);
}
Aggregations