A scala library with common toolset for RESTfull micro services built on Play Framework.
- Base REST API Controller
com.pb.microplay.controllers.components.ApiControllerActions
supporting:- cross-thread request context tracking in logs with a correlation id. injected for any
apiAction
in controllers inheriting fromApiControllerActions
. implementation:com.pb.microplay.logging.MDCManager
,com.pb.microplay.logging.MDCPropagatingDispatcherConfigurator
- json/xml content negotiation
- global error handlers returns json response
- cross-thread request context tracking in logs with a correlation id. injected for any
- HTTP trace filter. GZIP content negotiation filter
- swagger UI and swagger core integration
- exposes /health, /status /docs API endpoints
- Standard json based REST API consumer -
com.pb.microplay.services.RestApiConsumer
- Objects to Json conversion utils. under
\app\com\pb\microplay\utils
In sbt build file:
-
add JCenter repository resolver:
resolvers += Resolver.jcenterRepo
-
add the library as an sbt dependency:
libraryDependencies += "com.pb" %% "microplay" % "3.26.67" //or libraryDependencies += "com.pb" %% "microplay" % "3.26.+"
- Your projects configuration will inherit default configuration from microplay
application.conf
- you can review and decide to override these settings under themicro
nodemicro { //microplay default settings.... }
Microplay library version is in semver format but doesn't reflect the standard semver semantics.
in order to reflect the tight coupling of the dependant play framework version - the expected minor version is actually a concatenation of play major and minor versions.
so the version format is composed of:
<microplay-major>.<play-major><play-minor>.<microplay-minor>
- git clone
- import build.sbt in IDEA ®
- run sbt compile ( required so BuildInfoPlugin will generate BuildInfo class)
- right click microplay-lib/build.bst -> Run Play 2 App (verify PlayFramework support plugin installed)
- on code changes - > compile (Ctrl F9) and refresh browser
- re-run tests & publish locally -
sbt "project microplay-lib" clean compile test it:test publishLocal
Please refer to CONTRIBUTING.md
file.
Copyright (c) 2020 Pitney Bowes Inc. Licensed for free usage under the terms and conditions of Apache V2 - Apache V2 License.