Skip to content

1.9.1

Latest
Compare
Choose a tag to compare
@Artem-Semenov-dev Artem-Semenov-dev released this 28 May 18:05

This is a minor release bringing a quality-of-life improvement, basing on Spine's real world usage.

EnvSetting utility (#1550)

The EnvSetting is a tool that allows configuring the value that may differ per environment type.

Previously it was an internal utility, but now it is available for all Spine-based projects.

Usage example:

    EnvSetting<UserReader> setting = new EnvSetting<>();
    setting.use(projectsUserReader(), Production.class)
           .use(localUserReader(), Local.class)
           .use(testsUserReader(), Tests.class);
    
    // ...

    // The instance is returned according to the current `Environment` type.
    final UserReader reader = setting.value(); 

In addition to making this class public, some changes were made to it comparing to its internal version:

  • introduced method chaining for a more fluent and convenient API (as shown in the example);
  • added a public endpoint to access the value configured for the current environment type;
  • API is made thread-safe, allowing concurrent read operations while ensuring exclusive access for write operations to maintain data integrity.

Migration

This release is fully compatible with core-java libraries 1.9.0. No special migration steps required.