The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

chemelathil (1) [Avatar] Offline
#1
Hello,
can you give some examples of how to access the actual target source from the proxy instance ?

need help to reference actual component from proxy.
Seam component is injected into a spring bean. Methods of seam component are required to be accessed inside the spring bean .

Does anyone have any example of using seam components in spring beans especially with proxy ?



I have a seam component injected in spring bean as follows.
SPRING CONTEXT below------------------------------------------------------
<seam:instance name="compSeam" create="true" scope="STATELESS" id="compSeam" proxy="true"/>

<beans:bean id="beanSpring" >
class="com.sys.authentication.ASpringBean" >
<beans:property name="compSeam" > <beans:ref local="compSeam" />
</beans:property>
</beans:bean>


SPRING BEAN CLASS below----------------------------------------------------------
package com.sys.authentication;

public class ASpringBean {

ASeamComponent compSeam;

public void setCompSeam(ASeamComponent compSeam) {

System.out.println("Setting Seam AseamComponent in ASpring bean ");

this.compSeam = compSeam;

}

public ASeamComponent getCompSeam() {

return this.compSeam;

}

public String getSpringBeanUsername() {
return "Spring - username";
}

public String getSeamComponentUserName() { /---------------this method is giving error as envocationexception //
return compSeam.getUsername(); //
}

}

SEAM COMPONENT below------------------------------------------------------
package com.sys.authentication;

import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;

@Scope(ScopeType.STATELESS)
@Name("aSeam")
public class ASeamComponent {

public String getUsername() {
return "Seam - username";
}

}


This gives erorr on accessing the seam component's method