Skip to content

Extra Jakarta Mail properties use reversed configuration precedence #685

Closed

Description

@bbottema

Problem

Simple Java Mail documents configuration precedence as:

system property > environment variable > property file

ConfigLoader.readProperties() applies that order to ordinary properties. However, simplejavamail.extraproperties.* values are inserted into their result map in this order:

system properties -> environment variables -> supplied properties

Because later putAll() calls overwrite earlier entries, a supplied property-file value currently beats both runtime sources. This contradicts the documented contract and the ordering used for wildcard connection-pool cluster properties.

The extra Session-property namespace was introduced in #279; no collision test or documented exception indicates that the reversed precedence was intentional.

Expected behavior

Extra Jakarta Mail properties should follow the same precedence as the rest of ConfigLoader:

system property > environment variable > property file

Scope

  • apply extra properties in file -> environment -> system order;
  • add regression coverage for colliding values from all supported sources;
  • document that wildcard extra properties follow the normal precedence rules;
  • add a v9.2.0 migration/release note because applications relying on the accidental reverse order may observe a different value.

This is intentionally scheduled for the next minor release because it changes observable configuration behavior.

Activity

  1. added this to the v9.2.0 milestone on Aug 6, 2026
  2. bbottema commented on Aug 6, 2026

    @bbottema
    OwnerAuthor

    Fixed for v9.2.0. simplejavamail.extraproperties.* now follows the normal configuration order: system properties override environment variables, which override property-file values. Configurations that define an extra Jakarta Mail key in only one source are unchanged; when a key is duplicated, the deployment-time source now wins as documented. The 9.2 migration and release notes call out that compatibility detail.

  3. bbottema commented on Aug 8, 2026

    @bbottema
    OwnerAuthor

    This issue's change is now available in Simple Java Mail 9.2.0 and from Maven Central.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions