From line 14 added to lines 14 to 68:
*This feature is scheduled for inclusion in the JSR-299 maintenance release.*
+ Abstract producer methods
Remap qualifiers, EL name and/or scope (or just alias them) using an interface method declaration:
`@Produces @Named("foo") @Foo Baz foo(@Bar Baz bar);`
*This feature is scheduled for inclusion in the JSR-299 maintenance release.*
+ Generic beans
Allow a portable extension to define a set of "generic beans" for a specific "config annotation" like |@MessageBus|. These beans can inject the configuration, and can inject each other.
`@Generic(MessageBus.class)
@ApplicationScoped
class Topic {
@Inject MessageBus config;
}`
`@Generic(MessageBus.class)
@RequestScoped
class Session {
@Inject Topic topic;
@Inject MessageBus config;
}`
You can then add the config annotation to a producer field, together with whatever qualifier annotations you need:
`@Produces
@MessageBus(topic="default")
Topic topic;
@Produces @Prices
@MessageBus(topic="prices")
Topic prices;
@Produces @Deals
@MessageBus(topic="deals")
Topic deals;`
And now, finally, we can inject the "configured objects":
`@Inject Topic topic;
@Inject Session session;
@Inject @Prices Topic topic;
@Inject @Prices Session session;
@Inject @Deals Topic topic;
@Inject @Deals Session session;`
The trick here is that the |@Prices Session| gets the |@Prices Topic| injected, along with |@MessageBus(topic="prices") |, and the |@Deals Session| gets the |@Deals Topic| injected, along with |@MessageBus(topic="deals")|.
From lines 22 to 28 deleted to line 77:
+ |@BeanTypes| annotation
Allows the bean types of a bean to be explicitly specified by the user, instead of discovered by walking the type hierarchy.
`@BeanTypes(SpecialFoo.class)
class SpecialFoo extends Foo { ... }`
From lines 56 to 61 deleted to line 104:
+ Qualifier mappings
Remap qualifiers and name (or just alias them) using an interface method declaration:
`@Produces @Named("foo") @Foo Baz foo(@Bar Baz bar);`
From line 68 added to lines 110 to 126:
+ Guice-style configuration API
An API for registering beans programmatically.
`class MyModule extends Module {
@Override void configure() {
addManagedBean(FooBean.class)
.withQualfiers(Bar.class)
.withBeanTypes(Foo.class, Bar.class)
.withName("foo");
}
}`
Where each |Module| is a 299 |Extension|.
From line 103 changed to line 162:
@PersistenceContext(type=EXTENDED) EntityManager em;`
@PersistenceContext EntityManager em;`
From line 107 changed to line 166:
Support injection of JDK |Logger| objects:
Support injection of [SLF4J=>http://www.slf4j.org/] |Logger| objects:
From line 109 changed to line 168:
`@Inject Logger;`
`@Inject Logger log;`
From line 146 changed to line 205:
A set of annotations for constraining the application of stereotypes, qualifier types, etc, beyond what is possible using |@Target|. For example, the ability to constrain the scope and/or bean types of beans with a certain stereotype.
A set of annotations for constraining the application of stereotypes, qualifier types, etc, beyond what is possible using |@Target|. For example, the ability to constrain the scope and/or bean types of beans with a certain stereotype.
From line 151 added to lines 210 to 213:
+ Integration with Spring, Guice, Seam2
To allow interoperation with the legacy proprietary DI solutions. Note that if/when 330 provides a configuration API, we will probably be able to implement a general-purpose integration layer with extremely minimal dependencies to 299 or proprietary code.