search.Config class in os-core-common does not respect Spring configuration

Change Type:

  • Feature
  • Bugfix
  • Refactoring

Context and Scope

Implementation of org.opengroup.osdu.core.common.search.Config class make it hard to use class in modules and introduce several implicit issues:

  1. Spring does not support ingestion of @Values in static fields. The fact that the class is annotated with Spring annotations (@Component, @Value) misled because class can be used only as a general Java class (Config.QUERY_DEFAULT_LIMIT)
  2. Because Spring can't populate variables, configuration can be passed ONLY as Env variables.
  3. The Class introduce implicit dependency on other Search related Variables in the code even module could not use them.
  4. The Class introduce implicit dependency on GCP specific Variables for all CSPs. E.g. code of all CSPs will check presence of GOOGLE_CLOUD_PROJECT variable even it is GCP specific.

Screen_Shot_2020-08-27_at_4.07.50_PM

Decision

  • Move org.opengroup.osdu.core.common.search.Config class from os-core-common. Application configuration should be specified on microservice level, not in common library

Rational

  1. Dependency on Spring in common 'library' make it hard to use from hosting code
  2. Dependency on os-core-common make application implicitly aware about all Spring components / variables declared in library

Consequences

  1. New search.Config class should be added in microservices that use the class (Search)
  2. Changes in OS Core Common > QueryUtils.getResultSizeForQuery()
Edited by Dmitriy Rudko