Skip to content

RASCHCM-3 Refactor play-cms in order to reduce static state and improve DI flexibility

Raphael Mäder requested to merge RASCHCM-IMPROVEMENTS into master

Created by: ssokolenko

The biggest problem with play-cms/auth/commons is heavy use of static state which is pain to manage, especially in concurrent environment where static state is shared between multiple processes. The recent shift to DI in playframework made static state even more painful as DI and static state are enemies (https://github.com/google/guice/wiki/AvoidStaticState).

So, this PR slightly reduces some static state which was not so deeply rooted into the play-cms and thus not so painful to remove:

  • Deprecate static CMS in favor of injectable CMSApi
  • Make Metrics non-static and injectable; also, had to remove metrics from BlockFinder as it cannot rely on DI
  • Move the "reset" logic into it's own class from CMSApi; the setup logic should be simplified further...
  • Move Formatters registration from CMSApi into injectable Provider as suggested by official play docs
  • Split DI modules into more fine grained modules for more flexiblity when overriding them in child projects
  • Update to the latest stable playframework
  • Refactor cms setup mechanism. The older cms "Setup" class was quite hard to understand and use; often it just didn't worked due to strange jpa or other errors; simultanious call to the reset route could lead to unpredicted outcome. Thus, the setup code was completely rewritten with ease of use and stability in mind.

Merge request reports