In a managed bean, @PostConstruct is called after the regular Java object constructor.
Why would I use @PostConstruct to initialize by bean, instead of the regular constructor itself?
We have a situation where we provide an external configuration in form of a Map to our running programs. I have found that JSR-330 Dependency Injection gives a much cleaner way to use that configuration map in the code instead of passing the map…
How can I use JSR-299 CDI to inject (not annotated) beans from external libraries?
Examples:
Interface X and its implementations come from a third party lib. How can I decide which implementation to use?
class A {
@Inject
private X…
I have noticed from several web pages that apparently Spring 3.0 supports @Inject from JSR-330. As we would really like to use JSR-299 syntax for dependency injection in our libraries for both web apps and stand-alone applications, and have…
In Spring it was possible to instantiate any class by defining the corresponding bean in xml conf. It was also possible to instantiate more then one bean for the same class with different parameters.....
Are the such features in CDI as well,…
I know it is still not quite popular, since the spec was released just a few months ago.
I haven't "installed" weld yet, I'm just reading, and by this question I want to make sure I've understood this important point correct:
Is resolution of beans…
Part of my problem here is using the proper vocabulary, so I apologize in advance for what might be a simple matter of terminology.
Suppose I have a Person interface, and a PersonBean class that implements that interface.
Suppose further I have a…
I was reading a Wikipedia article about Java EE application servers here:
http://en.wikipedia.org/wiki/Java_Platform,_Enterprise_Edition#Java_EE_5_certified
It says that 2 APIs that Java App Services implement…
JSR-299 (CDI) introduces the (unfortunately named) concept of a resource: http://docs.jboss.org/weld/reference/1.0.0/en-US/html/resources.html#d0e4373
You can think of a resource in this nomenclature as a bridge between the Java EE 6 brand of…
Perhaps it's just too many hours of combing through the CDI 1.0 specification, but I couldn't find a detailed description of exactly where a META-INF/beans.xml was required.
(The section on bean discovery makes a few tantalizing statements that…
I have a producer method that creates instances of—let's say—Person.
The instance that this method creates is of type PersonBean and quite obviously implements Person.
This class has an initializer method in it:
@Inject
public void…
I want to fire an event in CDI whose type I can only determine on runtime. For instance, let's say there's some interface A with implementing classes AA and AB. I have two observers:
public void observeAA(@Observes AA aa) {
}
public void…
I am reading through the Public Review Draft of the Web Beans specification (JSR-299) and I am wondering why it is so 'tightly coupled' to JSF?
Especially the Conversation Context seems only be specified for JSF.
I understand, that it is a goal of…
Is there any easy way to remove these nasty Netbeans warnings about "Unsatisfied dependency: no bean matches the injection point"? The problem is that the GWT and Errai packages do NOT contain beans.xml files and therefore do not contain activated…
In terms of simplicity and correctness, what is the best way to inject objects of the same class with different scopes?
In a servlet I want to have injected objects of the same class with different scopes.
Still don't know if going to use…