Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cached injector for common modules #3

Closed
wants to merge 5 commits into from
Closed

Conversation

Litemn
Copy link
Contributor

@Litemn Litemn commented Oct 4, 2018

In original implementantion for each test guice create new injector and if we bind somting in scope SINGLETON - that not work as expected.

In this pr I provide basic implementation of cache for injectors with same modules - can you provide some feedback? @JeffreyFalgout

@JeffFaer
Copy link
Owner

JeffFaer commented Oct 4, 2018

What's your use case? Why would you want to share singleton instances across tests?

@Litemn
Copy link
Contributor Author

Litemn commented Oct 4, 2018

At least connection pools to DB or some shared state (I know that shared states is bad idea, but sometimes it very helpful)

@JeffFaer
Copy link
Owner

JeffFaer commented Oct 5, 2018

Ideally you would fake out the DB connection so it isn't terribly expensive, but I can see some value in a feature like this.

I don't think it should be enabled by default, but adding some annotation that lets users opt into shared injectors would be reasonable

@Litemn
Copy link
Contributor Author

Litemn commented Oct 5, 2018

I add @SharedInjectors annotation for cached inhectors enabled

@JeffFaer
Copy link
Owner

Looks good, thanks for bearing with me!

@JeffFaer JeffFaer closed this in 2583e80 Oct 18, 2018
@JeffFaer
Copy link
Owner

This will be available as part of 1.1.0

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