Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-9918

Reduce code duplication in ContextLoaderUtils

    Details

    • Type: Refactoring
    • Status: Closed
    • Priority: Minor
    • Resolution: Complete
    • Affects Version/s: 3.2 M2
    • Fix Version/s: 3.2 RC1
    • Component/s: Test
    • Labels:
      None
    • Last commented by a User:
      false

      Description

      Status Quo

      In ContextLoaderUtils, these two methods contain similar loop logic:

      • resolveContextLoaderClass(Class<?>, String)
      • resolveContextConfigurationAttributes(Class<?>)

      Proposed Solution

      1. extract the duplicated loop logic into a new method.

        Activity

        Show
        tadaya Tadaya Tsuyukubo added a comment - pull request: https://github.com/SpringSource/spring-framework/pull/173
        Hide
        sbrannen Sam Brannen added a comment -

        Completed as described in the comments from GitHub commit 33d5b011d3:

        Reduce code duplication in ContextLoaderUtils

        Prior to this commit, the following two methods in ContextLoaderUtils
        contained almost identical loops for traversing the test class
        hierarchy:

        • resolveContextLoaderClass(Class<?>, String)
        • resolveContextConfigurationAttributes(Class<?>)

        With this commit, resolveContextLoaderClass() no longer traverses the
        class hierarchy. Instead, it now works directly with the resolved list
        of ContextConfigurationAttributes, thereby removing code duplication.

        Show
        sbrannen Sam Brannen added a comment - Completed as described in the comments from GitHub commit 33d5b011d3 : Reduce code duplication in ContextLoaderUtils Prior to this commit, the following two methods in ContextLoaderUtils contained almost identical loops for traversing the test class hierarchy: resolveContextLoaderClass(Class<?>, String) resolveContextConfigurationAttributes(Class<?>) With this commit, resolveContextLoaderClass() no longer traverses the class hierarchy. Instead, it now works directly with the resolved list of ContextConfigurationAttributes, thereby removing code duplication.

          People

          • Assignee:
            sbrannen Sam Brannen
            Reporter:
            tadaya Tadaya Tsuyukubo
            Last updater:
            Chris Beams
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:
              Days since last comment:
              5 years, 4 weeks, 6 days ago