Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdi-dev] Guice to CDI migration

Just a small suggestion - it would be awesome if after the migration is done, you could consider writing a blog entry on it. I believe it would be highly appreciated in the community. If you gave me a heads up, I would be delighted to spread the word on it.

Reza Rahman
Jakarta EE Ambassador, Author, Blogger, Speaker

Please note views expressed here are my own as an individual community member and do not reflect the views of my employer.

Sent via the Samsung Galaxy S7, an AT&T 4G LTE smartphone


-------- Original message --------
From: Amit MENDAPARA - Axelor <amit@xxxxxxxxxx>
Date: 3/11/20 1:38 AM (GMT-05:00)
To: cdi developer discussions <cdi-dev@xxxxxxxxxxx>
Subject: Re: [cdi-dev] Guice to CDI migration

Hi Emily,
 
I have tried using "@Alternative" but I have to use qualifiers to inject this alternative. Is there any way we can make the CDI container use the "EnhancedGreetingServiceImpl" automatically without any qualifiers (without any changes in module-a or app itself).
I don't think you need to use any qualifier here. You need to use `@Priority` to enable the alternative. The other way to completely override a bean, you can use `@Specializes`.  By the way, I am not 100% sure what your use case is. A working example helps if you need further assistance.


I never used CDI before so it's new to me and I don't know many of it's concepts (I know guice very well so at least DI and AOP concepts might be similar). So I will try your suggestion but on twitter one user recommended me to check `@Specializes` and that seems the proper solution as per it's javadoc.

The project I am going to migrate is relatively complex and there are few more cases I would like to discuss here. I will try to provide a test case example that covers some of them.

Regards
--
Amit Mendapara
 

Back to the top