Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@RommelTJ
Copy link
Contributor

@RommelTJ RommelTJ commented Oct 4, 2024

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

Copy link
Member

@mkurz mkurz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@mergify
Copy link
Contributor

mergify bot commented Feb 18, 2025

This pull request has been removed from the queue for the following reason: pull request branch update failed.

The pull request can't be updated

You should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it.

If you want to requeue this pull request, you need to post a comment with the text: @mergifyio requeue

@mkurz
Copy link
Member

mkurz commented Feb 18, 2025

@Mergifyio rebase

@mergify
Copy link
Contributor

mergify bot commented Feb 18, 2025

rebase

✅ Branch has been successfully rebased

@mkurz mkurz force-pushed the docs-eager-bindings branch from b4664fc to fad3d03 Compare February 18, 2025 22:40
@mkurz
Copy link
Member

mkurz commented Feb 18, 2025

@Mergifyio backport 3.0.x 2.9.x

@mergify
Copy link
Contributor

mergify bot commented Feb 18, 2025

backport 3.0.x 2.9.x

✅ Backports have been created

Details

@mergify
Copy link
Contributor

mergify bot commented Feb 18, 2025

This pull request has been removed from the queue for the following reason: pull request branch update failed.

The pull request can't be updated

You should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it.

If you want to requeue this pull request, you need to post a comment with the text: @mergifyio requeue

@mkurz mkurz merged commit 3cc3443 into playframework:main Feb 18, 2025
29 of 31 checks passed
mergify bot added a commit that referenced this pull request Feb 19, 2025
[2.9.x] Eager bindings docs clarification (backport #12896) by @RommelTJ
mergify bot added a commit that referenced this pull request Feb 19, 2025
[3.0.x] Eager bindings docs clarification (backport #12896) by @RommelTJ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document dev mode not running eager bindings on start

3 participants