| Issue 61: | Lucyでxml設定とオブジェクトの登録を併用した場合に、@Injectでインジェクトされない | |
| 1 person starred this issue and may be notified of changes. | Back to list |
このようなコードでうまくいかない。
@SingletonScope
public class InitMethodBehaviorTest extends LucyTestCase {
private Initializable target;
public void setUpHoge() throws Exception {
Lucy lucy = getLucy();
lucy.load("lucy/behavior/InitMethod.xml");
lucy.register(this);
}
public void testHoge() {
Lucy lucy = getLucy();
assertNotNull(lucy.get(Initializable.class));
assertNotNull(this.target);
assertTrue(this.target.is());
}
@Inject
public void setTarget(Initializable target) {
this.target = target;
}
public Initializable getTarget() {
return this.target;
}
interface Initializable {
boolean is();
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE lucy-config PUBLIC "-//LUCY//DTD LUCY//EN"
"http://www.lucy.org/dtd/lucy-config.dtd">
<lucy-config>
<component class="lucy.behavior.InitializableImpl" />
</lucy-config>
Jul 30, 2008
Project Member
#1
shinpei.ohtani@gmail.com
Status:
Fixed
|