Hi Martin

Two questions:
1. Which class? HomePageHandler ?
2. I have digged deeper and in fact there is a check whether to use CGLib
or Objenesis (if there is no-args constructor Objenesis is chosen) but is
it an expected behaviour? Or maybe this case could be a trigger to discuss
proper way to deal with such cases?

On 4 April 2017 at 21:26, Martin Grigorov <martin.grigo...@gmail.com> wrote:

> Hi,
>
> On Apr 4, 2017 7:38 PM, "Tomasz Dziurko" <tdziu...@gmail.com> wrote:
>
> 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(
>
>
> I think you will need an additional default constructor for this class.
> CGLIB needs it.
> It might have lesser visibility than public too.
>
> 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/
>



-- 
Regards / Pozdrawiam,
Tomek Dziurko
http://tomaszdziurko.com/

Reply via email to