-
1. Re: Custom Credentials in Seam 3
lightguard Jul 20, 2011 2:47 PM (in response to jmonteiro)The short answer is you'll have to Veto it.
The way to do that varies, you could create an extension to do it, I think you can also do it with Seam Config.
This also seems like a bug, those classes should be the default if there isn't another one that satisfies the contract. Could you please add a JIRA (Arquillian test case preferred)?
-
2. Re: Custom Credentials in Seam 3
hantsy Jul 20, 2011 8:22 PM (in response to jmonteiro)try add @Specializes to the bean, according to weld doc, it will override and replace the default bean at runtime.
-
3. Re: Custom Credentials in Seam 3
azakovorotny Jul 26, 2011 12:05 PM (in response to jmonteiro)Hi Jorge,
I use @Specialized version of the CredantialsImpl (as suggested by hantsy bay) and it works fine:
@Inject Credentials credentials; String captcha = ((CustomCredentials) credentials.getCapture;
-
4. Re: Custom Credentials in Seam 3
smurfs.smurfsturf.googlemail.com Jul 27, 2011 5:06 PM (in response to jmonteiro)You can also use @Alternative, as in...
package com.example; @Alternative @Named("credentials") @SessionScoped public class MyCredentialsImpl extends CredentialsImpl { //...implementation }
and include the following in beans.xml
<alternatives> <class>com.example.MyCredentialsImpl</class> </alternatives>
You may find you need to use this approach if you are running JBoss AS (I'm developing with AS 7). There is a known bug in Weld with the @Specializes annotation, specifically, deployment fails when the annotated class specialises a class in a different archive (as is the case with Seam Security). See https://issues.jboss.org/browse/WELD-912 for more info.