Hi Robin,

I found that using RunningModeHelper.determineRunningMode(null) does the
same thing :)

My problem now is that my Settings object:
        new MutableSettings(runningMode)
has an empty property list, instead of containing all my spring managed
properties (defined in
WEB-INF/cocoon/properties/[runningMode]/*.properties)

I've tried with your approach:
        (Settings) WebAppContextUtils.getCurrentWebApplicationContext().
        getBean(Settings.ROLE)
, and now I get some system properties, but still don't get my custom
properties.

I've just noticed that "The properties defined in these property files
are only used for overriding bean configurations! These values are not
available through the settings object" [1], so I guess that I'm trying
to do an impossible thing and I'll have to use the "old" ResourceBundles
to read the property files...

Thanks very much, anyway :)

Regards,
Antonio J.


[1]
http://cocoon.apache.org/subprojects/configuration/1.0/spring-configurat
or/2.0/1312_1_1.html



> -----Mensaje original-----
> De: Robin Wyles [mailto:[EMAIL PROTECTED]
> Enviado el: viernes, 10 de octubre de 2008 13:06
> Para: [email protected]
> Asunto: Re: Cocoon Configuration API usage - how to get running mode?
> 
> Hi,
> 
> If I understand correctly you want to determine the value of the
> property "org.apache.cocoon.mode", am I right?
> 
> If so you can do it like this:
> 
> String mode = ((Settings)
> WebAppContextUtils.getCurrentWebApplicationContext().getBean
> (Settings.ROLE)).getProperty("org.apache.cocoon.mode");
> 
> Not pretty, but it works :)
> 
> Cheers,
> 
> Robin
> 
> 
> On 10 Oct 2008, at 08:18, Perez Guerrero, Antonio Javier wrote:
> 
> > Hi,
> >
> > How can I read spring managed properties from Java, without
> > defining my classes as beans?
> >
> > I've tried using org.apache.cocoon.configuration.MutableSettings,
> > which has all the methods that I need... But I cannot instantiate
> > it because I don't know how to determine the current running mode.
> > Any ideas on how to achieve it?
> >
> > Thanks in advance
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to