You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by jchappelle <jc...@4redi.com> on 2016/01/12 14:40:14 UTC

Conflicting warnings about location of wicket.properties in Wicket 7

I have a dashboard library that we use at our company. It has an Initializer.
The wicket.properties file is stored in the same package as the rest of the
code, not in a META-INF folder. After upgrading to Wicket 7 I started
noticing the following warning:

//wicket.properties location is deprecated. Please move the file to
/META-INF/wicket/ folder and give it a name that matches your packages'
name, e.g. com.example.myapp.properties/

So I thought, no problem, I'll just follow the instructions in the well
written message and move the properties file and rename it. I renamed the
file to com.redi.wicket.dashboard.properties and moved it to META-INF/wicket
folder. Now I get the following warning:

//META-INF/wicket/*.properties doesn't work in OSGi and single-jar
environments and is not supported anymore! Please see
https://issues.apache.org/jira/browse/WICKET-5997 for more details and
report an issue for the library that still uses it./

I looked at WICKET-5997, WICKET-6030 AND WICKET-5713 and tried to piece
together what I was supposed to do.

I've noticed in the Application class there are deprecated methods regarding
this and one, collectWicketProperties, that will be removed in 7.3.0. So I'd
like to get this fixed while it is fresh on my mind and not have it bite me
down the road when I upgrade.

So where do I put my initializer properties file and what do I name it?

Thanks




--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Conflicting-warnings-about-location-of-wicket-properties-in-Wicket-7-tp4673269.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: Conflicting warnings about location of wicket.properties in Wicket 7

Posted by jchappelle <jc...@4redi.com>.
Thank you Martin!

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Conflicting-warnings-about-location-of-wicket-properties-in-Wicket-7-tp4673269p4673277.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: Conflicting warnings about location of wicket.properties in Wicket 7

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

Sorry for the misleading first warning messages!
We have to change them to mention /META-INF/services/... directly.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Tue, Jan 12, 2016 at 4:40 PM, jchappelle <jc...@4redi.com> wrote:

> I'm adding my own answer in hopes that it helps someone in the future.
>
> I figured it out by looking at the code for org.apache.wicket.Application.
> Here the developers mention that you should use the ServiceLoader class for
> Initializers. https://issues.apache.org/jira/browse/WICKET-5997. I noticed
> the Application.initInitializers method and saw the ServiceLoader class
> they
> were talking about.
>
> So I read up on the java.util.ServiceLoader class and it states the
> following:
>
> A service provider is identified by placing a provider-configuration file
> in
> the resource directory META-INF/services. The file's name is the
> fully-qualified binary name of the service's type. The file contains a list
> of fully-qualified binary names of concrete provider classes, one per line.
>
> So I created a META-INF/services folder and put a text file named
> org.apache.wicket.IInitializer and inside the file I put the fully
> qualified
> class name of my IInitializer implementation.
>
> The warning went away and my Initializer was called on application startup
> which is exactly what I wanted.
>
> NOTE: If you are migrating from using wicket.properties make sure to take
> out the "initializer=" part of the file. The new way is not a properties
> file so it doesn't have key value pairs. It only has fully qualified class
> names separated by new lines. See the java.util.ServiceLocator
> documentation
> if you need more details.
>
> Also if you are using maven, the META-INF/services folder will go in
> src/main/resources.
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Conflicting-warnings-about-location-of-wicket-properties-in-Wicket-7-tp4673269p4673270.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Conflicting warnings about location of wicket.properties in Wicket 7

Posted by jchappelle <jc...@4redi.com>.
I'm adding my own answer in hopes that it helps someone in the future. 

I figured it out by looking at the code for org.apache.wicket.Application.
Here the developers mention that you should use the ServiceLoader class for
Initializers. https://issues.apache.org/jira/browse/WICKET-5997. I noticed
the Application.initInitializers method and saw the ServiceLoader class they
were talking about.

So I read up on the java.util.ServiceLoader class and it states the
following:

A service provider is identified by placing a provider-configuration file in
the resource directory META-INF/services. The file's name is the
fully-qualified binary name of the service's type. The file contains a list
of fully-qualified binary names of concrete provider classes, one per line.

So I created a META-INF/services folder and put a text file named
org.apache.wicket.IInitializer and inside the file I put the fully qualified
class name of my IInitializer implementation.

The warning went away and my Initializer was called on application startup
which is exactly what I wanted.

NOTE: If you are migrating from using wicket.properties make sure to take
out the "initializer=" part of the file. The new way is not a properties
file so it doesn't have key value pairs. It only has fully qualified class
names separated by new lines. See the java.util.ServiceLocator documentation
if you need more details.

Also if you are using maven, the META-INF/services folder will go in
src/main/resources.

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Conflicting-warnings-about-location-of-wicket-properties-in-Wicket-7-tp4673269p4673270.html
Sent from the Users forum mailing list archive at Nabble.com.

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