Spring Config

This plugin is used to read Spring Boot style application properties files.

Define the profile names

Profile names can be defined at job configuration. Job Configuration Or job folder configuration Folder Configuration In structures where two or more folders are nested, all profile name are merged together.

Retrieve the profile names

Use SpringProfiles() to retrieve the profile names defined

def profiles=springProfiles()

Get value from spring application style configuration file

This plugin supports custom location and profiles. The returned value is a nested Map object.

Suppose there's a yaml style application.yaml config file.

foo:
  bar: value1

Read the config file

def config=springConfig()
print config.foo.bar // Nested style
print config.asProperties()['foo.bar'] // All keys are flattened
print config.asPropertiesFileContent()  // It returns standard Java properties file format. All no ascii string are escapted.

Each build has a 'Spring Config' page which shows the configuration read by this plugin.

Parameters

  • profiles: A list of profiles. See detail at Spring Document.

  • location: The custom location. The plugin reads the configuration files either at current directory (workspace root or dir step) or a config sub directory. If not in these two, a relative path must be specified. This path must end with '/' if it is a directory.

  • hideInBuildPage: Don't show the configurations in the build 'Spring Config' page.

Example:

def profiles=springProfiles()
def config=springConfig(profiles: profiles, location : 'custom-config/,custom-config2/')