0
我以歐芹開始,無法使自動裝配工作。我的配置基於flex 4.5和parsley 3.0.0。歐芹自動裝配不起作用
我的應用程序中包含如下因素bootrap:
<fx:Declarations>
<parsley:ViewSettings autowireComponents="true"/>
<parsley:ContextBuilder config="{SimulateurConfig}" />
<s:TraceTarget
includeCategory="true"
includeLevel="true"
includeTime="true"
level="{LogEventLevel.DEBUG}"
>
<s:filters>
<fx:String>org.spicefactory.parsley.*</fx:String>
</s:filters>
</s:TraceTarget>
</fx:Declarations>
的配置也非常簡單:
<fx:Declarations>
<View type="com.coach.ui.PanelAFinancer"/>
<Object type="com.coach.domain.AFinancer" />
</fx:Declarations>
我的面板包含:
<fx:Script><![CDATA[
import com.coach.domain.AFinancer;
[Bindable] [Inject]
public var model:AFinancer;
]]></fx:Script>
<s:Label text="Model injected? { model != null }"/>
我認爲我做的一切都是正確的,但在我看來,這個模型並沒有被注入。跟蹤指示:
[trace] 12:49:12.186 [INFO] org.spicefactory.parsley.core.state.manager.impl.DefaultGlobalDomainManager Using new ApplicationDomain for key [object _Flex_simulateur_mx_managers_SystemManager]
[trace] 12:49:12.218 [INFO] org.spicefactory.parsley.core.view.impl.DefaultViewManager Add view root: Flex_simulateur0/Flex_simulateur
[trace] 12:49:12.218 [INFO] org.spicefactory.parsley.core.bootstrap.impl.DefaultBootstrapManager Creating Context [Context(FlexConfig{SimulateurConfig})] without parent
[trace] 12:49:12.296 [INFO] org.spicefactory.parsley.core.lifecycle.impl.DefaultManagedObjectHandler Configure managed object with [ObjectDefinition(type = com.coach.domain::AFinancer, id = _SimulateurConfig_MxmlRootObjectTag1)] and 0 processor(s)
沒有視圖處理的跡象。
如果我添加了«手動配置»在面板:
<fx:Declarations>
<sf:Configure/>
</fx:Declarations>
注射工作:
[trace] 12:56:04.983 [INFO] org.spicefactory.parsley.core.state.manager.impl.DefaultGlobalDomainManager Using new ApplicationDomain for key [object _Flex_simulateur_mx_managers_SystemManager]
[trace] 12:56:05.015 [INFO] org.spicefactory.parsley.core.view.impl.DefaultViewManager Add view root: Flex_simulateur0/Flex_simulateur
[trace] 12:56:05.030 [INFO] org.spicefactory.parsley.core.bootstrap.impl.DefaultBootstrapManager Creating Context [Context(FlexConfig{SimulateurConfig})] without parent
[trace] 12:56:05.124 [INFO] org.spicefactory.parsley.core.lifecycle.impl.DefaultManagedObjectHandler Configure managed object with [ObjectDefinition(type = com.coach.domain::AFinancer, id = _SimulateurConfig_MxmlRootObjectTag1)] and 0 processor(s)
[trace] 12:56:05.140 [DEBUG] org.spicefactory.parsley.core.view.handler.ViewConfigurationHandler Process view 'Flex_simulateur0.ApplicationSkin3._ApplicationSkin_Group1.contentGroup.viewRoot.PanelAFinancer7' with [Context(FlexConfig{SimulateurConfig})]
[trace] 12:56:05.155 [INFO] org.spicefactory.parsley.core.lifecycle.impl.DefaultManagedObjectHandler Configure managed object with [ObjectDefinition(type = com.coach.ui::PanelAFinancer, id = _SimulateurConfig_MxmlViewTag1)] and 1 processor(s)
[trace] 12:56:05.155 [DEBUG] org.spicefactory.parsley.core.lifecycle.impl.DefaultManagedObjectHandler Applying [Property(name=[Property model in class com.coach.ui::PanelAFinancer],value={ImplicitTypeReference(type=undefined)})] to managed object with [ObjectDefinition(type = com.coach.ui::PanelAFinancer, id = _SimulateurConfig_MxmlViewTag1)]
[trace] 12:56:05.171 [DEBUG] org.spicefactory.parsley.core.view.processor.DefaultViewProcessor Add view 'Flex_simulateur0.ApplicationSkin3._ApplicationSkin_Group1.contentGroup.viewRoot.PanelAFinancer7' to [Context(FlexConfig{SimulateurConfig})]
的解決方法是相當沉重,因爲它需要將我的所有視圖專有標籤。
任何想法,我的配置有什麼問題?
它可能工作,但我的問題是有沒有依賴於parsleys乾淨的看法。我總是覺得使用IoC很煩人,並且在代碼中需要很多框架配置。 http://www.spicefactory.org/parsley/docs/3.0/manual/view.php#config_automatic的第一句表明它應該起作用。 – GaetanZ 2012-03-12 17:22:09
是的,你應該可以做到這一點。不要指定類的字符串,而是直接綁定類:''你如何將視圖添加到屏幕? –
2012-03-12 17:43:10
沒有新的,只是我的應用程序mxml中的標籤。 – GaetanZ 2012-03-13 08:10:02