You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Ned Collyer <ne...@gmail.com> on 2008/06/30 08:01:40 UTC
How to ... nicely wire "strings" through spring.
Hi,
I'm using dependency injection via @SpringBean, and I need access to
configurable String value in my Application class.
My main context file is using a
org.springframework.beans.factory.config.PropertyPlaceholderConfigurer which
allows me to use ${} syntax for wiring values from a set of properties files
directly to a bean definition.
Eg,
GenericNonWicketApp.properties
configDir=/usr/banana/config
AppContext.xml
<bean class="someclass">
<property name="configDir" value="${configDir}" />
</bean>
I'd like to be able to wire this value against the WebApplication in wicket,
and I have been able to do this as follows:
<bean id="configDir" class="java.lang.String">
<constructor-arg index="0" value="${configDir}" />
</bean>
MyWebApplication.java
@SpringBean(name = "configDir")
private String configDir;
Is this the desired way of configuring these type of things (eg, simple
objects such as Strings and Integers)?
--
View this message in context: http://www.nabble.com/How-to-...-nicely-wire-%22strings%22-through-spring.-tp18189203p18189203.html
Sent from the Wicket - User 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: How to ... nicely wire "strings" through spring.
Posted by Ned Collyer <ne...@gmail.com>.
Just implemented that inbetween refreshes of here.
Thanks Igor.
igor.vaynberg wrote:
>
> create an applicationpropreties bean and set its values via the ${}
> syntax. then inject that into wicket components.
>
> -igor
>
--
View this message in context: http://www.nabble.com/How-to-...-nicely-wire-%22strings%22-through-spring.-tp18189203p18189313.html
Sent from the Wicket - User 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: How to ... nicely wire "strings" through spring.
Posted by Igor Vaynberg <ig...@gmail.com>.
create an applicationpropreties bean and set its values via the ${}
syntax. then inject that into wicket components.
-igor
On Sun, Jun 29, 2008 at 11:01 PM, Ned Collyer <ne...@gmail.com> wrote:
>
> Hi,
>
> I'm using dependency injection via @SpringBean, and I need access to
> configurable String value in my Application class.
>
> My main context file is using a
> org.springframework.beans.factory.config.PropertyPlaceholderConfigurer which
> allows me to use ${} syntax for wiring values from a set of properties files
> directly to a bean definition.
>
> Eg,
> GenericNonWicketApp.properties
> configDir=/usr/banana/config
>
> AppContext.xml
> <bean class="someclass">
> <property name="configDir" value="${configDir}" />
> </bean>
>
> I'd like to be able to wire this value against the WebApplication in wicket,
> and I have been able to do this as follows:
>
> <bean id="configDir" class="java.lang.String">
> <constructor-arg index="0" value="${configDir}" />
> </bean>
>
> MyWebApplication.java
> @SpringBean(name = "configDir")
> private String configDir;
>
>
> Is this the desired way of configuring these type of things (eg, simple
> objects such as Strings and Integers)?
> --
> View this message in context: http://www.nabble.com/How-to-...-nicely-wire-%22strings%22-through-spring.-tp18189203p18189203.html
> Sent from the Wicket - User 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
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org