Help

Built with Seam

You can find the full source code for this website in the Seam package in the directory /examples/wiki. It is licensed under the LGPL.

Work in progress list of enhancements to javax.enterprise.inject.spi for the CDI 1.0 maintenance release and CDI 1.1.

Producer field initializers

This is a generalization of CDI's built-in support for Java EE component environment resources, allowing portable extensions to define their own annotations that work like @Resource, @PersistenceContext, @EJB and friends in a producer field declaration. For example:

@Produces @JMS(topic=".../prices") 
@Prices Topic topic;

We would need to introduce a new interface in the SPI package:

public interface Initializer<X> {
    public X getInitialValue(AnnotatedField<?> field);
}

Along with a ProcessProducerField event type extending ProcessProducer with a setInitializer() method.

Ability to obtain a container-created bean for a Producer or InjectionTarget or for an AnnotatedType

A convenience feature to minimize the number of anonymous classes implementing Bean and minimize implementation errors.

Add:

  • createBean(types, qualifiers, scope, name, stereotypes, alternative, beanClass, InjectionTarget it), and
  • createBean(atypes, qualifiers, scope, name, stereotypes, alternative, beanClass, nullable, Producer p)

to BeanManager.

Or, perhaps:

  • introduce BeanAttributes interface as a supertype of Bean, with
  • BeanManager.createBeanAttributes(), together with
  • createBean(BeanAttributes ba, InjectionTarget it) and createBean(BeanAttributes ba, Producer p).

Also add:

  • createBean(AnnotatedType at)

to BeanManager.

Ability to override attributes of a Bean

Wrapping the AnnotatedType just to add an annotation is a real PITA.

We should make it possible to mess with the scope/qualifiers/name/etc of a bean either from ProcessBean event, or, better from a ProcessBeanAttributes event which lets you wrap the BeanAttributes or give the container a new one created with BeanManager.createBeanAttributes().

Ability to process modules

Add ProcessModule event which let's you mess with the enabled alternatives/interceptors/decorators and more:

public interface ProcessModule {
    public Set<Class> getAlternatives();
    public List<Class> getInterceptors();
    public List<Class> getDecorators();
    public Set<AnnotatedType> getAnnotatedTypes();
    public Set<Extension> getExtensions();
}

Ability to wrap the InjectionPoint

Add ProcessInjectionPoint event, along with BeanManager.createInjectionPoint(annotatedMember).

Allow injection of Instance<X> into portable extensions

It's more convenient for a portable extension to use Instance than BeanManager.getBeans() followed by BeanManager.getInstance().

Clarify that there can be multiple AnnotatedType instances per Java class

This is not 100% clear in the spec.

Obtain Extension instances from BeanManager

Add public <T extends Extension> T getExtension(Class<T> extensionClass) to BeanManager.

Use Module object, instead of Class for inter-module dependency resolution

We should add Module and Bean.getModule() instead of using getBeanClass() as a proxy for the module when doing inter-module dependency resolution.

2 comments:
 
30. Dec 2009, 01:09 America/New_York | Link

Looks good. Would the ProcessModule event allow you to add new AnnotatedTypes after you have already 'seen' all the existing annotated types in the Bean discovery phase?

 
07. Jan 2010, 20:42 America/New_York | Link
Stuart Douglas wrote on Dec 30, 2009 01:09:
Looks good. Would the ProcessModule event allow you to add new AnnotatedTypes after you have already 'seen' all the existing annotated types in the Bean discovery phase?

Stuart, that's an interesting question. No, I have not yet looked into this issue, though I understand why you would want to do it. I think that with the new createBean() and createBeanAttributes() methods described above, the need for this goes away. WDYT?

 

Learn more about Weld...