Hello
I have a problem with wicket-spring-boot <-> wicket integration. Bean
annotated with @Serviceis not properly injected into a backing bean that is
injected into a stateless Page using @SpringBean annotation.
Generally:
@StatelessComponent
@MountPath("home-page")
public class HomePage extends WebPage {
@SpringBean
private HomePageHandler handler;
}
and
@Service
public class HomePageHandler {
private final CommandPublisher commandPublisher;
@Autowired
public HomePageHandler(CommandPublisher commandPublisher) {
this.commandPublisher = commandPublisher;
}
public void executeAction(String name) {
commandPublisher.publish(name); /// <----------- NPE
(commandPublisher is null)
}
}
and:
@Service
public class CommandPublisher {
public void publish(String text) {
eventPublisher.publishEvent(text);
}
}
Wicket 7.6.0, wicket-spring-boot 1.0.6.
I have created a simple starter (
https://github.com/tdziurko/wicket-spring-bean-issue) to reproduce the
problem. Problem disappears when page is not stateless (more info in readme
in the starter).
Thank you in advance for help.
--
Regards / Pozdrawiam,
Tomek Dziurko
http://tomaszdziurko.com/