[JBoss Seam] - Post-injection hook (or how to avoid injection races?)
by thatrichard
Consider this component
| @Name("personEditor")
| @Stateful
| @Scope(ScopeType.CONVERSATION)
| @Conversational
| public class PersonEditorBean implements PersonEditor {
|
| @In
| private Person person;
|
| @In
| public void setTitle(String title) {
| //modify the title
| person.setTitle(title);
| }
|
|
This code will only work when "Person" is injected before "Title". What I think I need to do is to modify the setTitle method to store the value in a proxy and invoke another method, post-injection, to handle the modification, i.e.
| @In
| private Person person;
|
| private String titleProxy;
|
| @In
| public void setTitle(String title) {
| titleProxy = title;
| }
|
| private void updateTitle() {
| //modify titleProxy
| person.setTitle(titleProxy);
| }
|
|
For this to work I need a way of invoking the "updateTitle" method after injection, i.e. a post-injection hook. I am sure Seam supports something like this, but I'm not finding it.
Can someone point me in the right direction?
Richard
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4070948#4070948
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4070948
18Â years, 8Â months
[JBossCache] - Problem in interceptors
by AbdElrahman
Hi all
i am trying simple method-execution interceptor , my jboss-aop.xml file is
<?xml version="1.0" encoding="UTF-8"?>
and the class is
public class POJO
{
public void noop()
{
System.out.println("noop()");
}
public void test1(String param)
{
System.out.println("test1(String param): " + param);
}
public void test2(int param)
{
System.out.println("test2(int param): " + param);
callBar();
}
public static void test2()
{
System.out.println("static method");
}
public void callBar()
{
new Bar().hello();
}
public class Bar
{
public void hello() { System.out.println("hello"); }
}
}
the problem is that the method test1(String) doesnt intercepted , could anyone help me .
thank u
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4070947#4070947
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4070947
18Â years, 8Â months