You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@deltaspike.apache.org by Harald Wellmann <hw...@gmail.com> on 2013/03/25 18:31:36 UTC

Bean Validation

In Java EE 6, CDI injection into ConstraintValidators is not supported, 
as far as I know.

Does DeltaSpike fill this gap? Is it possible at all to hook into 
validation with a CDI extension?

Best regards,
Harald

Re: Bean Validation

Posted by "John D. Ament" <jo...@gmail.com>.
So then we'll talk about it more after 0.4 is out.


On Mon, Mar 25, 2013 at 5:27 PM, Mark Struberg <st...@yahoo.de> wrote:

> whoops, you r right :)
>
>
> LieGrue,
> strub
>
>
>
>
> ----- Original Message -----
> > From: John D. Ament <jo...@gmail.com>
> > To: deltaspike-users@incubator.apache.org; Mark Struberg <
> struberg@yahoo.de>
> > Cc:
> > Sent: Monday, March 25, 2013 10:24 PM
> > Subject: Re: Bean Validation
> >
> > I think you're a release behind Mark.
> > So maybe 0.5? :-)
> >
> >
> > On Mon, Mar 25, 2013 at 5:22 PM, Mark Struberg <st...@yahoo.de>
> wrote:
> >
> >>  +1 for adding, but plz only in 0.4.
> >>
> >>  Let's get 0.3 out of the door finally ;)
> >>
> >>  So I'd say we do a feature freeze for a few weeks and focus on getting
> > the
> >>  ongoing stuff done, ok?
> >>
> >>  LieGrue,
> >>  strub
> >>
> >>
> >>
> >>
> >>  ----- Original Message -----
> >>  > From: Gerhard Petracek <ge...@gmail.com>
> >>  > To: deltaspike-users@incubator.apache.org
> >>  > Cc:
> >>  > Sent: Monday, March 25, 2013 6:43 PM
> >>  > Subject: Re: Bean Validation
> >>  >
> >>  > hi harald,
> >>  >
> >>  > yes it is possible (see e.g. [1]).
> >>  > we are currently discussing, if we will add it.
> >>  >
> >>  > regards,
> >>  > gerhard
> >>  >
> >>  > [1] https://cwiki.apache.org/confluence/display/EXTCDI/BV+Usage
> >>  >
> >>  >
> >>  >
> >>  > 2013/3/25 Harald Wellmann <hw...@gmail.com>
> >>  >
> >>  >>  In Java EE 6, CDI injection into ConstraintValidators is not
> >>  supported, as
> >>  >>  far as I know.
> >>  >>
> >>  >>  Does DeltaSpike fill this gap? Is it possible at all to hook into
> >>  >>  validation with a CDI extension?
> >>  >>
> >>  >>  Best regards,
> >>  >>  Harald
> >>  >>
> >>  >
> >>
> >
>

Re: Bean Validation

Posted by Mark Struberg <st...@yahoo.de>.
whoops, you r right :)


LieGrue,
strub




----- Original Message -----
> From: John D. Ament <jo...@gmail.com>
> To: deltaspike-users@incubator.apache.org; Mark Struberg <st...@yahoo.de>
> Cc: 
> Sent: Monday, March 25, 2013 10:24 PM
> Subject: Re: Bean Validation
> 
> I think you're a release behind Mark.
> So maybe 0.5? :-)
> 
> 
> On Mon, Mar 25, 2013 at 5:22 PM, Mark Struberg <st...@yahoo.de> wrote:
> 
>>  +1 for adding, but plz only in 0.4.
>> 
>>  Let's get 0.3 out of the door finally ;)
>> 
>>  So I'd say we do a feature freeze for a few weeks and focus on getting 
> the
>>  ongoing stuff done, ok?
>> 
>>  LieGrue,
>>  strub
>> 
>> 
>> 
>> 
>>  ----- Original Message -----
>>  > From: Gerhard Petracek <ge...@gmail.com>
>>  > To: deltaspike-users@incubator.apache.org
>>  > Cc:
>>  > Sent: Monday, March 25, 2013 6:43 PM
>>  > Subject: Re: Bean Validation
>>  >
>>  > hi harald,
>>  >
>>  > yes it is possible (see e.g. [1]).
>>  > we are currently discussing, if we will add it.
>>  >
>>  > regards,
>>  > gerhard
>>  >
>>  > [1] https://cwiki.apache.org/confluence/display/EXTCDI/BV+Usage
>>  >
>>  >
>>  >
>>  > 2013/3/25 Harald Wellmann <hw...@gmail.com>
>>  >
>>  >>  In Java EE 6, CDI injection into ConstraintValidators is not
>>  supported, as
>>  >>  far as I know.
>>  >>
>>  >>  Does DeltaSpike fill this gap? Is it possible at all to hook into
>>  >>  validation with a CDI extension?
>>  >>
>>  >>  Best regards,
>>  >>  Harald
>>  >>
>>  >
>> 
> 

Re: Bean Validation

Posted by "John D. Ament" <jo...@gmail.com>.
I think you're a release behind Mark.
So maybe 0.5? :-)


On Mon, Mar 25, 2013 at 5:22 PM, Mark Struberg <st...@yahoo.de> wrote:

> +1 for adding, but plz only in 0.4.
>
> Let's get 0.3 out of the door finally ;)
>
> So I'd say we do a feature freeze for a few weeks and focus on getting the
> ongoing stuff done, ok?
>
> LieGrue,
> strub
>
>
>
>
> ----- Original Message -----
> > From: Gerhard Petracek <ge...@gmail.com>
> > To: deltaspike-users@incubator.apache.org
> > Cc:
> > Sent: Monday, March 25, 2013 6:43 PM
> > Subject: Re: Bean Validation
> >
> > hi harald,
> >
> > yes it is possible (see e.g. [1]).
> > we are currently discussing, if we will add it.
> >
> > regards,
> > gerhard
> >
> > [1] https://cwiki.apache.org/confluence/display/EXTCDI/BV+Usage
> >
> >
> >
> > 2013/3/25 Harald Wellmann <hw...@gmail.com>
> >
> >>  In Java EE 6, CDI injection into ConstraintValidators is not
> supported, as
> >>  far as I know.
> >>
> >>  Does DeltaSpike fill this gap? Is it possible at all to hook into
> >>  validation with a CDI extension?
> >>
> >>  Best regards,
> >>  Harald
> >>
> >
>

Re: Bean Validation

Posted by Mark Struberg <st...@yahoo.de>.
+1 for adding, but plz only in 0.4.

Let's get 0.3 out of the door finally ;)

So I'd say we do a feature freeze for a few weeks and focus on getting the ongoing stuff done, ok?

LieGrue,
strub




----- Original Message -----
> From: Gerhard Petracek <ge...@gmail.com>
> To: deltaspike-users@incubator.apache.org
> Cc: 
> Sent: Monday, March 25, 2013 6:43 PM
> Subject: Re: Bean Validation
> 
> hi harald,
> 
> yes it is possible (see e.g. [1]).
> we are currently discussing, if we will add it.
> 
> regards,
> gerhard
> 
> [1] https://cwiki.apache.org/confluence/display/EXTCDI/BV+Usage
> 
> 
> 
> 2013/3/25 Harald Wellmann <hw...@gmail.com>
> 
>>  In Java EE 6, CDI injection into ConstraintValidators is not supported, as
>>  far as I know.
>> 
>>  Does DeltaSpike fill this gap? Is it possible at all to hook into
>>  validation with a CDI extension?
>> 
>>  Best regards,
>>  Harald
>> 
> 

Re: Bean Validation

Posted by "John D. Ament" <jo...@gmail.com>.
It's a mixed case, because I believe you may be able to pull BV 1.1 in to
an EE 6 environment.  Same with JPA 2.1.


On Wed, Mar 27, 2013 at 9:08 AM, Harald Wellmann <hw...@gmail.com>wrote:

> I know this will be in Java EE 7 specs, but I guess Java EE 7
> implementations won't be ready for production before next year, so
> there's a gap to be filled for projects using Java EE 6 for
> production. That's why I'd like to see Bean Validation support in
> DeltaSpike 0.5.
>
> I've had a look at the CODI implementation which looks pretty
> straightforward to me - the only thing I don't see is how JSF picks up
> the CDI-enabled ValidatorFactory instead of the default one. Is this
> some magic in the CODI JSF module, or do you have to configure the
> factory in META-INF/validation.xml?
>
> Best regards,
> Harald
>
>
> 2013/3/25 Gerhard Petracek <ge...@gmail.com>:
> >
> > @ harald:
> > java-ee7 is going to support it out-of-the-box.
> > so we are discussing if and how we support it.
> > (fyi: you can also copy it. you just need few classes which are pretty
> > independent.)
> >
> > regards,
> > gerhard
>

Re: Bean Validation

Posted by Gerhard Petracek <ge...@gmail.com>.
hi harald,

in codi that isn't supported out-of-the-box (intentionally).
(fyi: basically it's allowed to cache the ValidatorFactory, but we also
don't do it (intentionally).)

you can inject and cache it yourself easily.
e.g. via a producer which exposes it as application scoped bean without
qualifier (or a custom qualifier).

for the integration with any other technology, you just have to resolve the
cached version.
e.g. in case of jsf2+ just replace the default-validator (with the id
javax.faces.Bean).
(or use the default integration via myfaces extval which is a bit more
complex, because it's also compatible with jsf 1.x).

regards,
gerhard



2013/3/27 Harald Wellmann <hw...@gmail.com>

> I know this will be in Java EE 7 specs, but I guess Java EE 7
> implementations won't be ready for production before next year, so
> there's a gap to be filled for projects using Java EE 6 for
> production. That's why I'd like to see Bean Validation support in
> DeltaSpike 0.5.
>
> I've had a look at the CODI implementation which looks pretty
> straightforward to me - the only thing I don't see is how JSF picks up
> the CDI-enabled ValidatorFactory instead of the default one. Is this
> some magic in the CODI JSF module, or do you have to configure the
> factory in META-INF/validation.xml?
>
> Best regards,
> Harald
>
>
> 2013/3/25 Gerhard Petracek <ge...@gmail.com>:
> >
> > @ harald:
> > java-ee7 is going to support it out-of-the-box.
> > so we are discussing if and how we support it.
> > (fyi: you can also copy it. you just need few classes which are pretty
> > independent.)
> >
> > regards,
> > gerhard
>

Re: Bean Validation

Posted by Harald Wellmann <hw...@gmail.com>.
I know this will be in Java EE 7 specs, but I guess Java EE 7
implementations won't be ready for production before next year, so
there's a gap to be filled for projects using Java EE 6 for
production. That's why I'd like to see Bean Validation support in
DeltaSpike 0.5.

I've had a look at the CODI implementation which looks pretty
straightforward to me - the only thing I don't see is how JSF picks up
the CDI-enabled ValidatorFactory instead of the default one. Is this
some magic in the CODI JSF module, or do you have to configure the
factory in META-INF/validation.xml?

Best regards,
Harald


2013/3/25 Gerhard Petracek <ge...@gmail.com>:
>
> @ harald:
> java-ee7 is going to support it out-of-the-box.
> so we are discussing if and how we support it.
> (fyi: you can also copy it. you just need few classes which are pretty
> independent.)
>
> regards,
> gerhard

Re: Bean Validation

Posted by Gerhard Petracek <ge...@gmail.com>.
@ hantsy:
there are some inconsistencies and redundant annotations across different
ee-specs, but everything you mentioned is possible
(in some cases you just need a portable cdi extension to support exactly
the same style, if you don't like the equivalent in java-ee).

@ harald:
java-ee7 is going to support it out-of-the-box.
so we are discussing if and how we support it.
(fyi: you can also copy it. you just need few classes which are pretty
independent.)

regards,
gerhard



2013/3/25 Harald Wellmann <hw...@gmail.com>

> Thanks, good to know - if this was supported in CODI, is there any good
> reason not to do it DeltaSpike?
>
> After all, DeltaSpike was supposed to supersede CODI and Seam...
>
> Best regards,
> Harald
>
> Am 25.03.2013 18:43, schrieb Gerhard Petracek:
>
>  hi harald,
>>
>> yes it is possible (see e.g. [1]).
>> we are currently discussing, if we will add it.
>>
>> regards,
>> gerhard
>>
>> [1] https://cwiki.apache.org/**confluence/display/EXTCDI/BV+**Usage<https://cwiki.apache.org/confluence/display/EXTCDI/BV+Usage>
>>
>>
>

Re: Bean Validation

Posted by Harald Wellmann <hw...@gmail.com>.
Thanks, good to know - if this was supported in CODI, is there any good 
reason not to do it DeltaSpike?

After all, DeltaSpike was supposed to supersede CODI and Seam...

Best regards,
Harald

Am 25.03.2013 18:43, schrieb Gerhard Petracek:
> hi harald,
>
> yes it is possible (see e.g. [1]).
> we are currently discussing, if we will add it.
>
> regards,
> gerhard
>
> [1] https://cwiki.apache.org/confluence/display/EXTCDI/BV+Usage
>


Re: Bean Validation

Posted by Gerhard Petracek <ge...@gmail.com>.
hi harald,

yes it is possible (see e.g. [1]).
we are currently discussing, if we will add it.

regards,
gerhard

[1] https://cwiki.apache.org/confluence/display/EXTCDI/BV+Usage



2013/3/25 Harald Wellmann <hw...@gmail.com>

> In Java EE 6, CDI injection into ConstraintValidators is not supported, as
> far as I know.
>
> Does DeltaSpike fill this gap? Is it possible at all to hook into
> validation with a CDI extension?
>
> Best regards,
> Harald
>

Re: Bean Validation

Posted by hantsy <ha...@yahoo.com.cn>.
Many facilities in Java EE 6 are not injectable, such as,
JSF: Converter, Validator, UIComponent, PhaseListener, XXXXEventLister...
JMS: MessageListener
JPA: EntityListener

ideally , all components should be injectable, some are considered as
stateful component and has its complete lifecycle, some like the ones in
the list  should be injectable but can not be injected into other beans,
maybe has a temporary conversation(if we must assign it into a scope).
Of course, Seam 3 made some effort on them, I have use JSF  converter
etc, but it must define the scope.

I remember in Java EE 7 maillist has some discussion like this.

Spring defined @Component and its refinements(@Service, @Repository, 
@Controller) as managed bean, and an @Configurable for none managed bean.

Unfortunately, Java EE 6/7 can not provide Spring like united @Component
annotation to define a managed bean, Java EE 6 defined  @ManagedBean,
but others annotations such as @Stateful, @Stateless, JSF @ManagedBean
are not refinements of Java EE defined @ManagedBean.

Hantsy
On 3/26/2013 01:31, Harald Wellmann wrote:
> In Java EE 6, CDI injection into ConstraintValidators is not
> supported, as far as I know.
>
> Does DeltaSpike fill this gap? Is it possible at all to hook into
> validation with a CDI extension?
>
> Best regards,
> Harald
>