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

Add method to TestPropertySourceUtils to add properties files directly to the environment

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Complete
    • Affects Version/s: None
    • Fix Version/s: 4.3 RC2
    • Component/s: Test
    • Labels:
      None
    • Last commented by a User:
      true

      Description

      TestPropertySourceUtils allows inlined properties to be added straight to a ConfigurableEnvironment but only allows properties file to be added to the environment via a ConfigurableApplicationContext.

      In Boot we'd like to create and configure the environment, set it on SpringApplication and then run the application which creates the application context. However,
      due to the current functionality provided by TestPropertySourceUtils, we're using an ApplicationContextInitializer to defer configuring the environment until the context has been created (see https://github.com/spring-projects/spring-boot/commit/69b08291992795ccea46b03dfc8bce53dd82174e) so that we have a ConfigurableApplicationContext to pass to TestPropertySourceUtils.

        Attachments

          Activity

            People

            Assignee:
            sbrannen Sam Brannen
            Reporter:
            awilkinson Andy Wilkinson
            Last updater:
            Spring Issuemaster
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Days since last comment:
              1 year, 40 weeks, 6 days ago