Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdi-dev] Regarding annotations

Hi,

Singleton came in with AtInject (JSR 330), currently Jakarta Dependency Injection. It's not a CDI annotation, although since CDI depends on Jakarta Dependency Injection you get it for "free" on your classpath whenever you use CDI.

For the longest time AtInject was not under control of anyone associated with CDI, so it could not have been removed. It also would not have made sense, since the entire purpose of AtInject was for it to be used by Spring, Guice, HK2 and others next to CDI.

Currently Jakarta has forked AtInject into Jakarta Dependency Injection. I'm not sure if Spring, Guice, etc are ever going to adopt it. If not, then essentially I wonder if Jakarta Dependency Injection could/should not be folded into CDI, and then indeed remove Singleton. It's not a super easy thing to do though.

Kind regards,
Arjan Tijms



On Mon, Dec 14, 2020 at 2:02 AM Abhideep Chakravarty <abhideepchakravarty@xxxxxxxxx> wrote:
Hi team,

I have recently migrated to Helidon from classic EE application. One problem I faced there was that the CDI stopped working. After getting some help, I was suggested to replace @Singleton with @ApplicationScoped. Once that's done things started working.

I was discussing the same with Reza Rehman a day back after seeing his news letter on Jakarta EE 10. He suggests not to use Singleton unless it's absolutely necessary.

Here is my concern:
If we have more than one option for doing same thing and other than one option everything else comes with 'use it if it's absolutely necessary' tag, then why don't we just remove those extra things and keep the one which is best to use. If we can remove in one shot, let's deprecate them.

Can we ?


Regards,
Abhideep 
_______________________________________________
cdi-dev mailing list
cdi-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/cdi-dev

Back to the top