Adam Warski

17 May 2010

CDI & Weld Extensions in Git

jee
dependency injection
java

Hello,

I’ve created a new cdiext project at github, initially with two extensions:

  1. Stackable Security Interceptors, about which I blogged here and here. Example usage:
@SecureBinding
@Secure("#{loggedInUser.administrator}")
public @interface AdministratorOnly {
}

public class SecureBean {
    @AdministratorOnly
    @Secure("#{additionalSecurityCheck}")
    public void doSecret() { ... }
}
  1. Injectable ELEvaluator, which works both during a faces request and outside of one (e.g. during invocation of an MDB). Example usage:
@Inject
private ELEvaluator elEvaluator;

void someMethod() {
    // ...
    Integer result = elEvaluator.evaluate(
            "#{testParam1 + 10 + testParam2}", Integer.class, params);
    // ...
}

Thanks to Dan Allen for helping out with this one.

There are also some tests done using Arquillian – looks like it’s going to be a great testing tool! :)

Adam

comments powered by Disqus

Any questions?

Can’t find the answer you’re looking for?