You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Per Newgro <pe...@gmx.ch> on 2019/08/28 08:25:24 UTC

Wicket Spring boot - use spring devtools

Hello *,

I migrate my current wicket app to spring boot version (https://github.com/MarcGiffing/wicket-spring-boot).

So far it was straightforward. But now i experience a problem with inclusion of
				<dependency>
					<groupId>org.springframework.boot</groupId>
					<artifactId>spring-boot-devtools</artifactId>
				</dependency>

It seems that the "restart / reload feature" of devtools loads my classes multiple times, so that they are not equal anymore (x.class <> x.class).
I understand that this is happening. But i would like to know if there is another option for me beside - removing spring-boot-devtools.

Would be nice to here from you
Thanks
Per

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Re: Wicket Spring boot - use spring devtools

Posted by Martin Grigorov <mg...@apache.org>.
On Wed, Aug 28, 2019 at 12:04 PM Per Newgro <pe...@gmx.ch> wrote:

> Hello Martin,
>
> the problem is that i assign a model in request cycle metadata by using
> the key
>
> public class IdentityInstance extends MetaDataKey<IModel<Identity>> {
>
>         public static IdentityInstance KEY = new IdentityInstance();
>
>         private IdentityInstance() {
>                 super();
>         }
> }
>
> Page:
> getRequestCycle().setMetaData(IdentityInstance.KEY, identityModel);
>
> Widget:
> IModel<Identity> identity =
> getRequestCycle().getMetaData(IdentityInstance.KEY);
>
> But the model in Widget is always null. While debugging i found that
> object identity is used in Class#equals(Object o), what is ok for me.
> But with different classloaders class is loaded multiple times.
>
> I could provide a quickstart for this & create an issue, if you like. (?)
>

No, I don't.
I don't see why Wicket should be responsible for the way other libraries
work.
If you create a quickstart that does not use any third party libraries then
we will take a look!


>
> I would like to adapt my configuration so that devtools are still
> available.
>
> (DCEVM i need to inspect :-).)
>
> Thanks for your support.
> Regards
> Per
>
> > Gesendet: Mittwoch, 28. August 2019 um 10:37 Uhr
> > Von: "Martin Grigorov" <mg...@apache.org>
> > An: "users@wicket.apache.org" <us...@wicket.apache.org>
> > Betreff: Re: Wicket Spring boot - use spring devtools
> >
> > Hi,
> >
> > This is how Spring Dev Tools work. When it detects a change it removes
> the
> > old application class loader and creates a new one.
> > Why this is a problem for you ?
> >
> > I personally prefer to use DCEVM (https://dcevm.github.io/). It is able
> to
> > redefine a specific class in the current class loader.
> > When I change a Spring @Configuration or Hibernate mapping I just restart
> > the application manually.
> >
> > On Wed, Aug 28, 2019 at 11:25 AM Per Newgro <pe...@gmx.ch> wrote:
> >
> > > Hello *,
> > >
> > > I migrate my current wicket app to spring boot version (
> > > https://github.com/MarcGiffing/wicket-spring-boot).
> > >
> > > So far it was straightforward. But now i experience a problem with
> > > inclusion of
> > >                                 <dependency>
> > >
> > > <groupId>org.springframework.boot</groupId>
> > >
> > > <artifactId>spring-boot-devtools</artifactId>
> > >                                 </dependency>
> > >
> > > It seems that the "restart / reload feature" of devtools loads my
> classes
> > > multiple times, so that they are not equal anymore (x.class <>
> x.class).
> > > I understand that this is happening. But i would like to know if there
> is
> > > another option for me beside - removing spring-boot-devtools.
> > >
> > > Would be nice to here from you
> > > Thanks
> > > Per
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > For additional commands, e-mail: users-help@wicket.apache.org
> > >
> > >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Aw: Re: Wicket Spring boot - use spring devtools

Posted by Per Newgro <pe...@gmx.ch>.
Hello Martin,

the problem is that i assign a model in request cycle metadata by using the key

public class IdentityInstance extends MetaDataKey<IModel<Identity>> {

	public static IdentityInstance KEY = new IdentityInstance();

	private IdentityInstance() {
		super();
	}
}

Page:
getRequestCycle().setMetaData(IdentityInstance.KEY, identityModel);

Widget:
IModel<Identity> identity = getRequestCycle().getMetaData(IdentityInstance.KEY);

But the model in Widget is always null. While debugging i found that object identity is used in Class#equals(Object o), what is ok for me.
But with different classloaders class is loaded multiple times.

I could provide a quickstart for this & create an issue, if you like. (?)

I would like to adapt my configuration so that devtools are still available.

(DCEVM i need to inspect :-).)

Thanks for your support.
Regards
Per

> Gesendet: Mittwoch, 28. August 2019 um 10:37 Uhr
> Von: "Martin Grigorov" <mg...@apache.org>
> An: "users@wicket.apache.org" <us...@wicket.apache.org>
> Betreff: Re: Wicket Spring boot - use spring devtools
>
> Hi,
>
> This is how Spring Dev Tools work. When it detects a change it removes the
> old application class loader and creates a new one.
> Why this is a problem for you ?
>
> I personally prefer to use DCEVM (https://dcevm.github.io/). It is able to
> redefine a specific class in the current class loader.
> When I change a Spring @Configuration or Hibernate mapping I just restart
> the application manually.
>
> On Wed, Aug 28, 2019 at 11:25 AM Per Newgro <pe...@gmx.ch> wrote:
>
> > Hello *,
> >
> > I migrate my current wicket app to spring boot version (
> > https://github.com/MarcGiffing/wicket-spring-boot).
> >
> > So far it was straightforward. But now i experience a problem with
> > inclusion of
> >                                 <dependency>
> >
> > <groupId>org.springframework.boot</groupId>
> >
> > <artifactId>spring-boot-devtools</artifactId>
> >                                 </dependency>
> >
> > It seems that the "restart / reload feature" of devtools loads my classes
> > multiple times, so that they are not equal anymore (x.class <> x.class).
> > I understand that this is happening. But i would like to know if there is
> > another option for me beside - removing spring-boot-devtools.
> >
> > Would be nice to here from you
> > Thanks
> > Per
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicket Spring boot - use spring devtools

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

This is how Spring Dev Tools work. When it detects a change it removes the
old application class loader and creates a new one.
Why this is a problem for you ?

I personally prefer to use DCEVM (https://dcevm.github.io/). It is able to
redefine a specific class in the current class loader.
When I change a Spring @Configuration or Hibernate mapping I just restart
the application manually.

On Wed, Aug 28, 2019 at 11:25 AM Per Newgro <pe...@gmx.ch> wrote:

> Hello *,
>
> I migrate my current wicket app to spring boot version (
> https://github.com/MarcGiffing/wicket-spring-boot).
>
> So far it was straightforward. But now i experience a problem with
> inclusion of
>                                 <dependency>
>
> <groupId>org.springframework.boot</groupId>
>
> <artifactId>spring-boot-devtools</artifactId>
>                                 </dependency>
>
> It seems that the "restart / reload feature" of devtools loads my classes
> multiple times, so that they are not equal anymore (x.class <> x.class).
> I understand that this is happening. But i would like to know if there is
> another option for me beside - removing spring-boot-devtools.
>
> Would be nice to here from you
> Thanks
> Per
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>