Loading properties file while using Spring @L

2010-02-07 Thread Alec Swan
I use Wicket, Spring and wicket-spring extensions. Spring configuration loads properties from config/env.properties file using PropertyPlaceholderConfigurer. I would like to add more properties to this file and read them from my Wicket application class. I tried to inject a Spring Resource using @S

Re: Loading properties file while using Spring @L

2010-02-07 Thread Igor Vaynberg
map the properties to a bean and inject that -igor On Sunday, February 7, 2010, Alec Swan wrote: > I use Wicket, Spring and wicket-spring extensions. Spring > configuration loads properties from config/env.properties file using > PropertyPlaceholderConfigurer. I would like to add more properties

Re: Loading properties file while using Spring @L

2010-02-08 Thread James Carman
You can use the Spring integration to actually create your application object for you: http://cwiki.apache.org/WICKET/spring.html#Spring-ApplicationObjectApproach Then, you can wire in anything into it that you want, just like any other Spring bean (because it *is* just another Spring bean) On S

Re: Loading properties file while using Spring @L

2010-02-08 Thread Alec Swan
Igor, were you suggesting the same approach as James did? If so, I am already using @SpringBean annotations and I am wondering if they will continue to work with the http://cwiki.apache.org/WICKET/spring.html#Spring-ApplicationObjectApproach approach? Thanks. On Mon, Feb 8, 2010 at 4:41 AM, Jame

Re: Loading properties file while using Spring @L

2010-02-08 Thread James Carman
I'm using both and they work fine. On Mon, Feb 8, 2010 at 11:18 AM, Alec Swan wrote: > Igor, were you suggesting the same approach as James did? > > If so, I am already using @SpringBean annotations and I am wondering > if they will continue to work with the > http://cwiki.apache.org/WICKET/sprin

Re: Loading properties file while using Spring @L

2010-02-08 Thread Igor Vaynberg
i usually create a seperate bean that represents the properties and let spring fill those in via the property configurer. then inject the bean and you are done. -igor On Mon, Feb 8, 2010 at 8:18 AM, Alec Swan wrote: > Igor, were you suggesting the same approach as James did? > > If so, I am alre

Re: Loading properties file while using Spring @L

2010-02-08 Thread Alec Swan
Igor, how do you inject the configuration bean in the Wicket application? Do you use http://cwiki.apache.org/WICKET/spring.html#Spring-ApplicationObjectApproach approach? Thanks, Alec On Mon, Feb 8, 2010 at 10:33 AM, Igor Vaynberg wrote: > i usually create a seperate bean that represents the pr

Re: Loading properties file while using Spring @L

2010-02-08 Thread Andrew Lombardi
the annotation-based approach is the most often used on that page. On Feb 8, 2010, at 5:28 PM, Alec Swan wrote: > Igor, how do you inject the configuration bean in the Wicket > application? Do you use > http://cwiki.apache.org/WICKET/spring.html#Spring-ApplicationObjectApproach > approach? > > T

Re: Loading properties file while using Spring @L

2010-02-08 Thread Igor Vaynberg
personally, i use salve (salve.googlecode.com) so i can inject into any object... -igor On Mon, Feb 8, 2010 at 5:28 PM, Alec Swan wrote: > Igor, how do you inject the configuration bean in the Wicket > application? Do you use > http://cwiki.apache.org/WICKET/spring.html#Spring-ApplicationObjectA

Re: Loading properties file while using Spring @L

2010-02-08 Thread Alec Swan
Andrew, I use @SpringBean annotations in Wicket components. How do you use annotation-based approach to inject dependencies in the Wicket application object? On Mon, Feb 8, 2010 at 6:30 PM, Andrew Lombardi wrote: > the annotation-based approach is the most often used on that page. > > On Feb 8, 2

Re: Loading properties file while using Spring @L

2010-02-08 Thread James Carman
You can inject anything you like that's annotated with the @SpringBean annotations: InjectorHolder.getInjector().inject(someNonComponentObject); On Mon, Feb 8, 2010 at 8:46 PM, Alec Swan wrote: > Andrew, I use @SpringBean annotations in Wicket components. How do you > use annotation-based approa

Re: Loading properties file while using Spring @L

2010-02-08 Thread Alec Swan
Thanks James, this is awesome! This is what I ended up doing in my Wicket WebApplication object: @SpringBean(name = "myConfiguration") private MyConfiguration myConfiguration; protected void init() { super.init(); // integrate with Spring addComponentInstantiationListener

Re: Loading properties file while using Spring @L

2010-02-08 Thread Alec Swan
Igor, I looked at Salve even though James suggestion will work for my small project. If I understood correctly Salve is an IoC container which can serialize objects with complex dependencies. I think this can be very useful when serializing Wicket components that depend on DAO or other types of se

Re: Loading properties file while using Spring @L

2010-02-08 Thread Igor Vaynberg
salve is a bytecode instrumentor that hooks into an existing ioc container and makes injecting any object easy and serialization-safe. -igor On Mon, Feb 8, 2010 at 6:13 PM, Alec Swan wrote: > Igor, I looked at Salve even though James suggestion will work for my > small project. > > If I understo