Skip to content

[2.9.x] Eager bindings docs clarification (backport #12896) by @RommelTJ#13127

Merged
mergify[bot] merged 1 commit into
2.9.xfrom
mergify/bp/2.9.x/pr-12896
Feb 19, 2025
Merged

[2.9.x] Eager bindings docs clarification (backport #12896) by @RommelTJ#13127
mergify[bot] merged 1 commit into
2.9.xfrom
mergify/bp/2.9.x/pr-12896

Conversation

@mergify
Copy link
Copy Markdown
Contributor

@mergify mergify Bot commented Feb 18, 2025

Pull Request Checklist

Helpful things

Fixes

Resolves #10469

Purpose

Adds documentation around differences in eager bindings between development and production modes.

Background Context

Requested in #10469.

I verified the behavior by creating a Hello World Play application and creating a custom binding and logging inside the service like this:

if (environment.mode == Mode.Dev) {
    logger.info("EagerService created in Development mode")
    println("EagerService created in Development mode")
  } else {
    logger.info("EagerService created in Production mode")
    println("EagerService created in Production mode")
  }

Then I added a module:

class EagerModule extends AbstractModule {
  override def configure(): Unit = {
    bind(classOf[EagerService]).asEagerSingleton()
    bind(classOf[ApplicationStart]).asEagerSingleton()
  }
}

And injected it into the HomeController:

class HomeController @Inject()(val controllerComponents: ControllerComponents, eagerService: EagerService)
  extends BaseController with I18nSupport {
  [...]

Then I ran the app in both dev and production modes and verified the behavior is different and documented it.

References

#10469


This is an automatic backport of pull request #12896 done by [Mergify](https://mergify.com).

Resolves #10469

(cherry picked from commit fad3d03)
@mergify mergify Bot mentioned this pull request Feb 18, 2025
7 tasks
mergify Bot added a commit that referenced this pull request Feb 18, 2025
@mergify mergify Bot merged commit bd046f2 into 2.9.x Feb 19, 2025
@mergify mergify Bot deleted the mergify/bp/2.9.x/pr-12896 branch February 19, 2025 00:26
@mkurz mkurz added this to the 2.9.7 milestone Mar 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants