user2022068
user2022068

Reputation:

How to instantiate CDI bean at runtime via [weld] API in JavaEE [7]?

I am newbie in CDI and I want to instantiate CDI bean via my XML files, but not via beans.xml. Is it possible and is it normal? Or maybe I misunderstand CDI concepts?

Upvotes: 0

Views: 411

Answers (1)

user2022068
user2022068

Reputation:

I found the answer.

A producer method is a method that acts as a source of bean instances. The method declaration itself describes the bean and the container invokes the method to obtain an instance of the bean when no instance exists in the specified context. A producer method lets the application take full control of the bean instantiation process.

Upvotes: 1

Related Questions