jakartaee / faces

Jakarta Faces
Other
102 stars 54 forks source link

Faces Standard Converters CDI ApplicationScoped #1952

Open pizzi80 opened 1 month ago

pizzi80 commented 1 month ago

Add @ApplicationScoped on stateless converters (BigInteger, BigDecimal, Float, .... )

1 line of code for each class, simple and effective

tandraschko commented 1 month ago

i dont think default converters/validators are managed by CDI?!

pizzi80 commented 1 month ago

don't know if this new Faces API package requires CDI

... probably could/should ?

Many years ago I read a blog post of @arjantijms proposing to switch to CDI to find Converters and Validators

Mojarra use both class scan and CDI

In my fork of Mojarra I use CDI @ApplicationScoped for all stateless converters, 1 instance per webapp...

otherwise they could be manually instantiated and cached

I was proposing the CDI solution because it's a 1 line of code

tandraschko commented 1 month ago

this issue is so much bigger 1) if we make CDI the default for converters/validators, we need: https://github.com/jakartaee/faces/issues/1584 2) we need to remove managed=true attr on annotations 3) we need to rework specs and impls 4) then we can just add @ApplicationScoped

pizzi80 commented 1 month ago

this issue is so much bigger

  1. if we make CDI the default for converters/validators, we need: Remove class scanning and rely on CDI only? #1584
  2. we need to remove managed=true attr on annotations
  3. we need to rework specs and impls
  4. then we can just add @ApplicationScoped

exactly :smiley:

I admit that for a 5.0 version of Faces one could expect all these things ...

CDI is now a Jakarta Core requirements, isn't it?

https://jakarta.ee/specifications/coreprofile/11/jakarta-coreprofile-spec-11.0-m4#required_components