2012-09-18 71 views
0

我需要我的應用程序從數據庫源讀取它的配置,但我必須應用自己的緩存機制來滿足更新配置和性能的靈活性(不需要訪問數據庫每當需要值時)(Tapestry v5.3.5)貢獻一個非緩存SymbolSource

執行緩存機制的服務是SymbolSourceImpl。因爲我需要掛毯來緩存可高速緩存的值,如JVM選項。我需要貢獻另一個符號源。但SymbolObjectProvider(分佈於MasterObjectProvider)僅保留SymbolSource的一個實例,我無法覆蓋SymbolSource默認綁定,所以我想像爲掛毯做默認SymbolObjectProvider一樣,爲MasterObjectProvider貢獻整個另一個符號對象提供者。

但在這裏是當我試圖貢獻我自己的符號對象提供的一個問題:

@Contribute(MasterObjectProvider.class) 
public static void setupDBSYmbolObjectProviders(OrderedConfiguration<ObjectProvider> configuration) { 
    configuration.addInstance("DBSymbol", **DBSymbolObjectProvider**.class, OrderConstraintBuilder.before("Symbol").build()); 
} 

DBSymbolObjectProvider構造是這樣的:

public DBSymbolObjectProvider(IDBSymbolSource symbolSource, @Builtin TypeCoercer typeCoercer) { 
    this.symbolSource = symbolSource; 
    this.typeCoercer = typeCoercer; 
} 

掛毯解決TypeCoercer但它couldn」 t解決IDBSymbolSource並拋出以下異常,這是合乎邏輯的,因爲MasterObjectProvider尚未構建以解決IDBSymbolSource

java.lang.RuntimeException: Exception constructing service 'RegistryStartup': Unable to instantiate class com.skycomm.IpKaizenTAModule as a module: Exception constructing service 'MasterObjectProvider': Error invoking service contribution method com.skycomm.ipkaizen.services.CoreModule.setupDBSYmbolObjectProviders(OrderedConfiguration): Exception constructing service 'MasterObjectProvider': Construction of service 'MasterObjectProvider' has failed due to recursion: the service depends on itself in some way. Please check org.apache.tapestry5.ioc.internal.services.MasterObjectProviderImpl(List, OperationTracker) (at MasterObjectProviderImpl.java:33) via org.apache.tapestry5.ioc.services.TapestryIOCModule.bind(ServiceBinder) (at TapestryIOCModule.java:49) for references to another service that is itself dependent on service 'MasterObjectProvider'. 
    at org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.obtainObjectFromCreator(JustInTimeObjectCreator.java:75) 
    at org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.createObject(JustInTimeObjectCreator.java:54) 
    at $Runnable_440ab1f4dbb6.delegate(Unknown Source) 
    at $Runnable_440ab1f4dbb6.run(Unknown Source) 
    at org.apache.tapestry5.ioc.internal.RegistryImpl.performRegistryStartup(RegistryImpl.java:325) 
    at org.apache.tapestry5.ioc.internal.RegistryWrapper.performRegistryStartup(RegistryWrapper.java:80) 
    at com.skycomm.IpKaizenTA.main(IpKaizenTA.java:25) 
Caused by: java.lang.RuntimeException: Unable to instantiate class com.skycomm.IpKaizenTAModule as a module: Exception constructing service 'MasterObjectProvider': Error invoking service contribution method com.skycomm.ipkaizen.services.CoreModule.setupDBSYmbolObjectProviders(OrderedConfiguration): Exception constructing service 'MasterObjectProvider': Construction of service 'MasterObjectProvider' has failed due to recursion: the service depends on itself in some way. Please check org.apache.tapestry5.ioc.internal.services.MasterObjectProviderImpl(List, OperationTracker) (at MasterObjectProviderImpl.java:33) via org.apache.tapestry5.ioc.services.TapestryIOCModule.bind(ServiceBinder) (at TapestryIOCModule.java:49) for references to another service that is itself dependent on service 'MasterObjectProvider'. 
    at org.apache.tapestry5.ioc.internal.ModuleImpl.instantiateModuleInstance(ModuleImpl.java:447) 
    at org.apache.tapestry5.ioc.internal.ModuleImpl.access$1200(ModuleImpl.java:39) 
    at org.apache.tapestry5.ioc.internal.ModuleImpl$6$1.invoke(ModuleImpl.java:355) 
    at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:74) 
    at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:87) 
    at org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1124) 
    at org.apache.tapestry5.ioc.internal.ModuleImpl$6.run(ModuleImpl.java:350) 
    at org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier$2.invoke(ConcurrentBarrier.java:200) 
    at org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier$2.invoke(ConcurrentBarrier.java:197) 
    at org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withWrite(ConcurrentBarrier.java:140) 
    at org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withWrite(ConcurrentBarrier.java:206) 
    at org.apache.tapestry5.ioc.internal.ModuleImpl$7.invoke(ModuleImpl.java:366) 
    at org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:85) 
    at org.apache.tapestry5.ioc.internal.ModuleImpl.getModuleBuilder(ModuleImpl.java:374) 
    at org.apache.tapestry5.ioc.internal.ContributionDefImpl.invokeMethod(ContributionDefImpl.java:113) 
    at org.apache.tapestry5.ioc.internal.ContributionDefImpl.contribute(ContributionDefImpl.java:80) 
    at org.apache.tapestry5.ioc.internal.RegistryImpl$9.run(RegistryImpl.java:633) 
    at org.apache.tapestry5.ioc.internal.OperationTrackerImpl$1.invoke(OperationTrackerImpl.java:51) 
    at org.apache.tapestry5.ioc.internal.OperationTrackerImpl$1.invoke(OperationTrackerImpl.java:48) 
    at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:74) 
    at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.run(OperationTrackerImpl.java:47) 
    at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.run(PerThreadOperationTracker.java:76) 
    at org.apache.tapestry5.ioc.internal.RegistryImpl.addToOrderedConfiguration(RegistryImpl.java:629) 
    at org.apache.tapestry5.ioc.internal.RegistryImpl.getOrderedConfiguration(RegistryImpl.java:483) 
    at org.apache.tapestry5.ioc.internal.ServiceResourcesImpl$2.invoke(ServiceResourcesImpl.java:110) 
    at org.apache.tapestry5.ioc.internal.ServiceResourcesImpl$2.invoke(ServiceResourcesImpl.java:107) 
    at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:74) 
    at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:87) 
    at org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1124) 
    at org.apache.tapestry5.ioc.internal.ServiceResourcesImpl.getOrderedConfiguration(ServiceResourcesImpl.java:105) 
    at org.apache.tapestry5.ioc.internal.AbstractServiceCreator.getOrderedConfiguration(AbstractServiceCreator.java:123) 
    at org.apache.tapestry5.ioc.internal.AbstractServiceCreator.access$200(AbstractServiceCreator.java:35) 
    at org.apache.tapestry5.ioc.internal.AbstractServiceCreator$1.findResource(AbstractServiceCreator.java:103) 
    at org.apache.tapestry5.ioc.internal.util.DelegatingInjectionResources.findResource(DelegatingInjectionResources.java:38) 
    at org.apache.tapestry5.ioc.internal.util.InternalUtils.calculateInjection(InternalUtils.java:231) 
    at org.apache.tapestry5.ioc.internal.util.InternalUtils.access$000(InternalUtils.java:50) 
    at org.apache.tapestry5.ioc.internal.util.InternalUtils$4.invoke(InternalUtils.java:289) 
    at org.apache.tapestry5.ioc.internal.util.InternalUtils$4.invoke(InternalUtils.java:286) 
    at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:74) 
    at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:87) 
    at org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1124) 
    at org.apache.tapestry5.ioc.internal.util.InternalUtils.calculateParameters(InternalUtils.java:293) 
    at org.apache.tapestry5.ioc.internal.util.InternalUtils$23.invoke(InternalUtils.java:1488) 
    at org.apache.tapestry5.ioc.internal.util.InternalUtils$23.invoke(InternalUtils.java:1483) 
    at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:74) 
    at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:87) 
    at org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1124) 
    at org.apache.tapestry5.ioc.internal.util.InternalUtils.createConstructorConstructionPlan(InternalUtils.java:1480) 
    at org.apache.tapestry5.ioc.internal.ConstructorServiceCreator.getPlan(ConstructorServiceCreator.java:52) 
    at org.apache.tapestry5.ioc.internal.ConstructorServiceCreator.createObject(ConstructorServiceCreator.java:61) 
    at org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator$1.invoke(OperationTrackingObjectCreator.java:45) 
    at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:74) 
    at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:87) 
    at org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1124) 
    at org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator.createObject(OperationTrackingObjectCreator.java:49) 
    at org.apache.tapestry5.ioc.internal.SingletonServiceLifecycle.createService(SingletonServiceLifecycle.java:29) 
    at org.apache.tapestry5.ioc.internal.LifecycleWrappedServiceCreator.createObject(LifecycleWrappedServiceCreator.java:46) 
    at org.apache.tapestry5.ioc.internal.AdvisorStackBuilder.createObject(AdvisorStackBuilder.java:63) 
    at org.apache.tapestry5.ioc.internal.InterceptorStackBuilder.createObject(InterceptorStackBuilder.java:54) 
    at org.apache.tapestry5.ioc.internal.RecursiveServiceCreationCheckWrapper.createObject(RecursiveServiceCreationCheckWrapper.java:60) 
    at org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator$1.invoke(OperationTrackingObjectCreator.java:45) 
    at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:74) 
    at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:87) 
    at org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1124) 
    at org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator.createObject(OperationTrackingObjectCreator.java:49) 
    at org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.obtainObjectFromCreator(JustInTimeObjectCreator.java:66) 
    ... 6 more 
Caused by: java.lang.RuntimeException: Exception constructing service 'MasterObjectProvider': Error invoking service contribution method com.skycomm.ipkaizen.services.CoreModule.setupDBSYmbolObjectProviders(OrderedConfiguration): Exception constructing service 'MasterObjectProvider': Construction of service 'MasterObjectProvider' has failed due to recursion: the service depends on itself in some way. Please check org.apache.tapestry5.ioc.internal.services.MasterObjectProviderImpl(List, OperationTracker) (at MasterObjectProviderImpl.java:33) via org.apache.tapestry5.ioc.services.TapestryIOCModule.bind(ServiceBinder) (at TapestryIOCModule.java:49) for references to another service that is itself dependent on service 'MasterObjectProvider'. 
    at org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.obtainObjectFromCreator(JustInTimeObjectCreator.java:75) 
    at org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.createObject(JustInTimeObjectCreator.java:54) 
    at $MasterObjectProvider_440ab1f4dbb7.delegate(Unknown Source) 
    at $MasterObjectProvider_440ab1f4dbb7.provide(Unknown Source) 
    at org.apache.tapestry5.ioc.internal.RegistryImpl.getObject(RegistryImpl.java:871) 
    at org.apache.tapestry5.ioc.internal.ObjectLocatorImpl.getObject(ObjectLocatorImpl.java:57) 
    at org.apache.tapestry5.ioc.internal.util.InternalUtils$6.run(InternalUtils.java:371) 
    at org.apache.tapestry5.ioc.internal.OperationTrackerImpl$1.invoke(OperationTrackerImpl.java:51) 
    at org.apache.tapestry5.ioc.internal.OperationTrackerImpl$1.invoke(OperationTrackerImpl.java:48) 
    at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:74) 
    at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.run(OperationTrackerImpl.java:47) 
    at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.run(PerThreadOperationTracker.java:76) 
    at org.apache.tapestry5.ioc.internal.RegistryImpl.run(RegistryImpl.java:1119) 
    at org.apache.tapestry5.ioc.internal.util.InternalUtils.injectIntoFields(InternalUtils.java:338) 
    at org.apache.tapestry5.ioc.internal.ModuleImpl.instantiateModuleInstance(ModuleImpl.java:433) 
    ... 71 more 
Caused by: java.lang.RuntimeException: Error invoking service contribution method com.skycomm.ipkaizen.services.CoreModule.setupDBSYmbolObjectProviders(OrderedConfiguration): Exception constructing service 'MasterObjectProvider': Construction of service 'MasterObjectProvider' has failed due to recursion: the service depends on itself in some way. Please check org.apache.tapestry5.ioc.internal.services.MasterObjectProviderImpl(List, OperationTracker) (at MasterObjectProviderImpl.java:33) via org.apache.tapestry5.ioc.services.TapestryIOCModule.bind(ServiceBinder) (at TapestryIOCModule.java:49) for references to another service that is itself dependent on service 'MasterObjectProvider'. 
    at org.apache.tapestry5.ioc.internal.ContributionDefImpl.invokeMethod(ContributionDefImpl.java:130) 
    at org.apache.tapestry5.ioc.internal.ContributionDefImpl.contribute(ContributionDefImpl.java:80) 
    at org.apache.tapestry5.ioc.internal.RegistryImpl$9.run(RegistryImpl.java:633) 
    at org.apache.tapestry5.ioc.internal.OperationTrackerImpl$1.invoke(OperationTrackerImpl.java:51) 
    at org.apache.tapestry5.ioc.internal.OperationTrackerImpl$1.invoke(OperationTrackerImpl.java:48) 
    at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:74) 
    at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.run(OperationTrackerImpl.java:47) 
    at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.run(PerThreadOperationTracker.java:76) 
    at org.apache.tapestry5.ioc.internal.RegistryImpl.addToOrderedConfiguration(RegistryImpl.java:629) 
    at org.apache.tapestry5.ioc.internal.RegistryImpl.getOrderedConfiguration(RegistryImpl.java:483) 
    at org.apache.tapestry5.ioc.internal.ServiceResourcesImpl$2.invoke(ServiceResourcesImpl.java:110) 
    at org.apache.tapestry5.ioc.internal.ServiceResourcesImpl$2.invoke(ServiceResourcesImpl.java:107) 
    at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:74) 
    at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:87) 
    at org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1124) 
    at org.apache.tapestry5.ioc.internal.ServiceResourcesImpl.getOrderedConfiguration(ServiceResourcesImpl.java:105) 
    at org.apache.tapestry5.ioc.internal.AbstractServiceCreator.getOrderedConfiguration(AbstractServiceCreator.java:123) 
    at org.apache.tapestry5.ioc.internal.AbstractServiceCreator.access$200(AbstractServiceCreator.java:35) 
    at org.apache.tapestry5.ioc.internal.AbstractServiceCreator$1.findResource(AbstractServiceCreator.java:103) 
    at org.apache.tapestry5.ioc.internal.util.DelegatingInjectionResources.findResource(DelegatingInjectionResources.java:38) 
    at org.apache.tapestry5.ioc.internal.util.InternalUtils.calculateInjection(InternalUtils.java:231) 
    at org.apache.tapestry5.ioc.internal.util.InternalUtils.access$000(InternalUtils.java:50) 
    at org.apache.tapestry5.ioc.internal.util.InternalUtils$4.invoke(InternalUtils.java:289) 
    at org.apache.tapestry5.ioc.internal.util.InternalUtils$4.invoke(InternalUtils.java:286) 
    at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:74) 
    at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:87) 
    at org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1124) 
    at org.apache.tapestry5.ioc.internal.util.InternalUtils.calculateParameters(InternalUtils.java:293) 
    at org.apache.tapestry5.ioc.internal.util.InternalUtils$23.invoke(InternalUtils.java:1488) 
    at org.apache.tapestry5.ioc.internal.util.InternalUtils$23.invoke(InternalUtils.java:1483) 
    at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:74) 
    at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:87) 
    at org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1124) 
    at org.apache.tapestry5.ioc.internal.util.InternalUtils.createConstructorConstructionPlan(InternalUtils.java:1480) 
    at org.apache.tapestry5.ioc.internal.ConstructorServiceCreator.getPlan(ConstructorServiceCreator.java:52) 
    at org.apache.tapestry5.ioc.internal.ConstructorServiceCreator.createObject(ConstructorServiceCreator.java:61) 
    at org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator$1.invoke(OperationTrackingObjectCreator.java:45) 
    at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:74) 
    at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:87) 
    at org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1124) 
    at org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator.createObject(OperationTrackingObjectCreator.java:49) 
    at org.apache.tapestry5.ioc.internal.SingletonServiceLifecycle.createService(SingletonServiceLifecycle.java:29) 
    at org.apache.tapestry5.ioc.internal.LifecycleWrappedServiceCreator.createObject(LifecycleWrappedServiceCreator.java:46) 
    at org.apache.tapestry5.ioc.internal.RecursiveServiceCreationCheckWrapper.createObject(RecursiveServiceCreationCheckWrapper.java:60) 
    at org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator$1.invoke(OperationTrackingObjectCreator.java:45) 
    at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:74) 
    at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:87) 
    at org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1124) 
    at org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator.createObject(OperationTrackingObjectCreator.java:49) 
    at org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.obtainObjectFromCreator(JustInTimeObjectCreator.java:66) 
    ... 85 more 
Caused by: java.lang.RuntimeException: Exception constructing service 'MasterObjectProvider': Construction of service 'MasterObjectProvider' has failed due to recursion: the service depends on itself in some way. Please check org.apache.tapestry5.ioc.internal.services.MasterObjectProviderImpl(List, OperationTracker) (at MasterObjectProviderImpl.java:33) via org.apache.tapestry5.ioc.services.TapestryIOCModule.bind(ServiceBinder) (at TapestryIOCModule.java:49) for references to another service that is itself dependent on service 'MasterObjectProvider'. 
    at org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.obtainObjectFromCreator(JustInTimeObjectCreator.java:75) 
    at org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.createObject(JustInTimeObjectCreator.java:54) 
    at $MasterObjectProvider_440ab1f4dbb7.delegate(Unknown Source) 
    at $MasterObjectProvider_440ab1f4dbb7.provide(Unknown Source) 
    at org.apache.tapestry5.ioc.internal.RegistryImpl.getObject(RegistryImpl.java:871) 
    at org.apache.tapestry5.ioc.internal.ObjectLocatorImpl.getObject(ObjectLocatorImpl.java:57) 
    at org.apache.tapestry5.ioc.internal.util.InternalUtils.calculateInjection(InternalUtils.java:257) 
    at org.apache.tapestry5.ioc.internal.util.InternalUtils.access$000(InternalUtils.java:50) 
    at org.apache.tapestry5.ioc.internal.util.InternalUtils$4.invoke(InternalUtils.java:289) 
    at org.apache.tapestry5.ioc.internal.util.InternalUtils$4.invoke(InternalUtils.java:286) 
    at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:74) 
    at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:87) 
    at org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1124) 
    at org.apache.tapestry5.ioc.internal.util.InternalUtils.calculateParameters(InternalUtils.java:293) 
    at org.apache.tapestry5.ioc.internal.util.InternalUtils$23.invoke(InternalUtils.java:1488) 
    at org.apache.tapestry5.ioc.internal.util.InternalUtils$23.invoke(InternalUtils.java:1483) 
    at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:74) 
    at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:87) 
    at org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1124) 
    at org.apache.tapestry5.ioc.internal.util.InternalUtils.createConstructorConstructionPlan(InternalUtils.java:1480) 
    at org.apache.tapestry5.ioc.internal.ConstructorServiceCreator.getPlan(ConstructorServiceCreator.java:52) 
    at org.apache.tapestry5.ioc.internal.ConstructorServiceCreator.createObject(ConstructorServiceCreator.java:61) 
    at org.apache.tapestry5.ioc.internal.ServiceResourcesImpl$4.invoke(ServiceResourcesImpl.java:160) 
    at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:74) 
    at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:87) 
    at org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1124) 
    at org.apache.tapestry5.ioc.internal.ServiceResourcesImpl.autobuild(ServiceResourcesImpl.java:146) 
    at org.apache.tapestry5.ioc.internal.ServiceResourcesImpl.autobuild(ServiceResourcesImpl.java:170) 
    at org.apache.tapestry5.ioc.internal.AbstractConfigurationImpl.instantiate(AbstractConfigurationImpl.java:45) 
    at org.apache.tapestry5.ioc.internal.ValidatingOrderedConfigurationWrapper.addInstance(ValidatingOrderedConfigurationWrapper.java:95) 
    at com.skycomm.ipkaizen.services.CoreModule.setupDBSYmbolObjectProviders(CoreModule.java:51) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 
    at java.lang.reflect.Method.invoke(Unknown Source) 
    at org.apache.tapestry5.ioc.internal.ContributionDefImpl.invokeMethod(ContributionDefImpl.java:120) 
    ... 134 more 
Caused by: org.apache.tapestry5.ioc.internal.OperationException: Construction of service 'MasterObjectProvider' has failed due to recursion: the service depends on itself in some way. Please check org.apache.tapestry5.ioc.internal.services.MasterObjectProviderImpl(List, OperationTracker) (at MasterObjectProviderImpl.java:33) via org.apache.tapestry5.ioc.services.TapestryIOCModule.bind(ServiceBinder) (at TapestryIOCModule.java:49) for references to another service that is itself dependent on service 'MasterObjectProvider'. 
    at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.logAndRethrow(OperationTrackerImpl.java:121) 
    at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:88) 
    at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:87) 
    at org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1124) 
    at org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator.createObject(OperationTrackingObjectCreator.java:49) 
    at org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.obtainObjectFromCreator(JustInTimeObjectCreator.java:66) 
    ... 169 more 
Caused by: java.lang.IllegalStateException: Construction of service 'MasterObjectProvider' has failed due to recursion: the service depends on itself in some way. Please check org.apache.tapestry5.ioc.internal.services.MasterObjectProviderImpl(List, OperationTracker) (at MasterObjectProviderImpl.java:33) via org.apache.tapestry5.ioc.services.TapestryIOCModule.bind(ServiceBinder) (at TapestryIOCModule.java:49) for references to another service that is itself dependent on service 'MasterObjectProvider'. 
    at org.apache.tapestry5.ioc.internal.RecursiveServiceCreationCheckWrapper.createObject(RecursiveServiceCreationCheckWrapper.java:52) 
    at org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator$1.invoke(OperationTrackingObjectCreator.java:45) 
    at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:74) 
    ... 173 more 

謝謝。

回答

1

即使您的自定義SymbolSource正常工作,我也不認爲您可以擁有可更新的符號(我將回到您可以如何操作的方式)。原因是符號如何插入到服務中。它們被插入到字段中,不會轉換爲間接訪問器方法。所以,即使您更改了該值,您的自定義SymbolSource也不會再次被調用來獲取該值。

如何貢獻自己的SymbolSource 只是裝點SymbolSource服務

public class AppModule { 

    public SymbolSource decorateSymbolSource(
     final SymbolSource symbolSource) { 
     return new MyCustomSymbolSource(symbolSource); 
    } 

} 

隨着MasterObjectProvider,不留一個服務,它被稱爲一個對象。如果您想使用MasterObjectProvider,則始終使用@Local作爲有助於解決服務和防止遞歸的本地服務。