Andrus Adamchik created CAY-2774:
------------------------------------

             Summary: Overriding service ordering in DI List causes 
DIRuntimeException
                 Key: CAY-2774
                 URL: https://issues.apache.org/jira/browse/CAY-2774
             Project: Cayenne
          Issue Type: Improvement
    Affects Versions: 4.2.RC1, 5.0.M1
            Reporter: Andrus Adamchik
            Assignee: Andrus Adamchik
             Fix For: 5.0.M1


Per CAY-2772, I just tried changing the ordering of a filter in 
ListBuilder<DataChannelSyncFilter> by re-binding the filter with different 
relative order. Essentially:

{noformat}
contributeSyncFilters().insertBefore(CommitLogFilter.class, 
TransactionFilter.class);
contributeSyncFilters().addAfter(CommitLogFilter.class, 
TransactionFilter.class);
{noformat}

This results in a dependency cycle exception:

{noformat}
org.apache.cayenne.di.DIRuntimeException: Dependency cycle detected in DI 
container

        at org.apache.cayenne.di.spi.DIGraph.topSort(DIGraph.java:155)
        at org.apache.cayenne.di.spi.ListProvider.get(ListProvider.java:47)
        at org.apache.cayenne.di.spi.ListProvider.get(ListProvider.java:35)
        at 
org.apache.cayenne.di.spi.DefaultScopeProvider.get(DefaultScopeProvider.java:50)
        at 
org.apache.cayenne.di.spi.DefaultInjector.getInstance(DefaultInjector.java:139)
        at 
org.apache.cayenne.di.spi.FieldInjectingProvider.value(FieldInjectingProvider.java:103)
{noformat}

I think we can actually properly handle this case by removing the existing 
ordering, and rebinding with the new ordering.




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to