On Tuesday, 3 April 2018, 10:25:38 CEST, Matej Novotny <manovotn@redhat.com> wrote:
Hi Alex,
Not sure if I get what you need to do, but I'll take a shot at it.
What about using @PostConstruct interceptor, in which you take the injected Application bean and use it to set internal state in SomeManagerImpl?
Same could be done directly within constructor (with @Inject annotation) or an initializer method.
E.g.
@ApplicationScoped
public class SomeManagerImpl implements SomeManager{} {
private MyConfiguration config;
@Inject
Application app;
@PostConstruct
public void doSomeInit() {
config = app.getConfig(); // get config from Application and appply here
}
}
If I misunderstood your question, please correct me :)
Matej
----- Original Message -----
> Sent: Saturday, March 31, 2018 1:07:59 PM
> Subject: [weld-dev] What is the best way to pass cofiguration to CDI bean using Weld?
>
> Hi all
>
> Could anyone suggest solution for the following situation.
> Lets suppose we have:
>
> public interface SomeManager{}
>
> @ApplicationScoped
> public class SomeManagerImpl implements SomeManager{}
>
> @ApplicationScoped
> public class Application {} //application entry point
>
> In Application I need to pass configuration to SomeManagerImpl, but I don't
> want to
> add setConfiguration method to SomeManager interface. What is the best way
> to do it in Weld? Maybe I use some CDI mechanisms, or add extra classes.
> Please, help.
>
> Best regards, Alex Sviridov
>
> _______________________________________________
> weld-dev mailing list
_______________________________________________
weld-dev mailing list