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:
- 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
) - Because Spring can't populate variables, configuration can be passed ONLY as Env variables.
- The Class introduce implicit dependency on other Search related Variables in the code even module could not use them.
- 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.
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
- Dependency on Spring in common 'library' make it hard to use from hosting code
- Dependency on
os-core-common
make application implicitlyaware
about all Spring components / variables declared in library
Consequences
- New
search.Config
class should be added in microservices that use the class (Search) - Changes in OS Core Common > QueryUtils.getResultSizeForQuery()
Edited by Dmitriy Rudko