I'm using SAS 1.1 and I can not seem to get property placeholders to work and it must be something simple I'm not doing because it's to obvious for it not to work. I have a very simple application that loads an application context and then traces out the properties in it and it doesn't work. I even tried creating another class and autowireing values to it and it doesn't seem to replace the placeholders.
Here is my application file:
My application-context.xml file isCode:<?xml version="1.0" encoding="utf-8"?> <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" creationComplete="handleCreationComplete()"> <fx:Script> <![CDATA[ import org.springextensions.actionscript.context.support.FlexXMLApplicationContext; import org.test.MyClass; private var _applicationContext:FlexXMLApplicationContext; protected function handleCreationComplete():void { trace("Loading xml"); _applicationContext = new FlexXMLApplicationContext("application-context.xml"); _applicationContext.addEventListener(Event.COMPLETE, complete_handler); _applicationContext.load(); } protected function complete_handler(event:Event):void { trace("Loaded xml"); _applicationContext.removeEventListener(Event.COMPLETE, complete_handler); baseURL.text = _applicationContext.properties.getProperty("baseURL"); trace("Base URL" + _applicationContext.properties.getProperty("baseURL")); trace("S1: " + _applicationContext.properties.getProperty("s1")); trace("S2: " + _applicationContext.properties.getProperty("s2")); var myObject:MyClass = _applicationContext.getObject("myObject"); var resolver:PropertyPlaceholderResolver = new PropertyPlaceholderResolver(); resolver.properties = _applicationContext.properties; resolver.resolvePropertyPlaceholders("s1"); trace("S2: " + _applicationContext.properties.getProperty("s2")); } ]]> </fx:Script> <s:Label x="10" y="10" text="Base URL:"/> <s:Label id="baseURL" x="77" y="10" text=""/> </s:WindowedApplication>
Any my autowired class is:Code:<?xml version="1.0" encoding="UTF-8"?> <objects xmlns="http://www.springactionscript.org/schema/objects" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springactionscript.org/schema/objects http://www.springactionscript.org/schema/objects/spring-actionscript-objects-1.0.xsd"> <property name="baseURL" value="http://www.example.com" /> <property name="s1" value="First string and ${s2}"/> <property name="s2" value="Second string"/> <object id="myObject" class="org.test.MyClass"> <property name="string1" value="${s1}"/> <property name="string2" value="${s2}"/> <property name="string3" value="string 3 value"/> </object> </objects>
Nothing I have tried has been able to get "s1" to resolve to what I was expecting according to the documentation section 2.1.1.4. External property filesCode:package org.test { public class MyClass { [Autowired] public var string1:String; [Autowired] public var string2:String; [Autowired] public var string3:String; [Autowired(externalProperty='s1')] public var string4:String; } }
I've been pulling my hair out with this so any help would be appreciated!


Reply With Quote
Soooo, many things to do though.... Beat with me 