Injector.inject(theInstance); or just use cdi: CDI.current().getBeanManager() then create an InjectionTarget
Romain Manni-Bucau @rmannibucau <https://twitter.com/rmannibucau> | Blog <https://blog-rmannibucau.rhcloud.com> | Old Blog <http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> | LinkedIn <https://www.linkedin.com/in/rmannibucau> | JavaEE Factory <https://javaeefactory-rmannibucau.rhcloud.com> 2017-04-25 15:08 GMT+02:00 hfe <a...@h41.de>: > Ok, I found a solution to mange this problem. I have my own > AnnotationFinder, > in this I override the Method findMetaAnnotatedClasses(...). > > There I have this code (all the code you can find > https://github.com/feidner/jsf-testing): > > if(annotation == ManagedBean.class) { > List<Annotated<Class<?>>> classes = > super.findMetaAnnotatedClasses(annotation); > Set<Class<?>> callers = getCallersFromSomewhere(); > classes.add(new AnnotatedTestObject<>(caller))); > return classes; > } > > --------------------------- > > public class AnnotatedTestObject<T> implements Annotated<T> { > private Annotation annotation = DefaultAnnotation.of( > ManagedBean.class); > private T obj; > > public AnnotatedTestObject(T obj) { > this.obj = obj; > } > > @Override > public T get() { > return obj; > } > > @Override > public <T extends Annotation> T getAnnotation(Class<T> annotationClass) > { > return (T)annotation; > } > > @Override > public Annotation[] getAnnotations() { > return new Annotation[] { annotation }; > } > > @Override > public Annotation[] getDeclaredAnnotations() { > return new Annotation[] { annotation }; > } > > } > > > > > > -- > View this message in context: http://tomee-openejb.979440. > n4.nabble.com/openejb-additionnal-callers-in-EmbeddedTomEEContainer- > tp4681588p4681593.html > Sent from the TomEE Users mailing list archive at Nabble.com. >