-
Notifications
You must be signed in to change notification settings - Fork 61
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
Document how to get an HttpClient when singletons are eagerly initialised #716
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a test and make the code in the docs come from the test.
What about the alternative of annotating the test with |
We can do, but this would break using the test as a factory, ie: #107 (comment) |
@sdelamo should I still add the test with |
Kudos, SonarCloud Quality Gate passed! |
Working on this 👍 |
Fails because you can't use |
ContextBuilder annotated classes do not respect Requires
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Yes, add the test with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add @PendingFeature test
Checked, and Pending feature works on test methods, and this failure is at class initialization time... |
* use Gradle Kotlin DSL * Update slsa-framework/slsa-github-generator action to v1.3.0 (#42) * ci: distribution temurin cla provenance (#44) * Update stefanzweifel/git-auto-commit-action action to v4.15.4 (#43) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * build: Micronaut Framework 3.7.4 * build: spock 2.2-groovy-3.0 * doc: eager singletons and inject HttpClient (#66) See micronaut-projects/micronaut-test#716 * ci: projectVersion 1.2.0-SNAPSHOT * ci: githubCoreBranch 3.9.x * build: Micronaut Framework 3.8.5 * build: Micronaut Test 3.8.2 * build: Spock 2.3-groovy-3.0 * wip DataSourceResolver * Convert Delegating datasource and filter non-hikari contents * Test * Test to ensure DBCP still works and isn't supported * Try to downgrade Jooq * remove @Inject BeanContext ctx * Simplify composite (#73) * Simplify composite * Extract common code to method --------- Co-authored-by: Tim Yates <[email protected]> * build: Micronaut Framework 3.8.6 * build: Micronaut Test 3.9.1 * ci: GitHub Actions sync * [skip ci] Release v1.2.0 * Back to 1.2.1-SNAPSHOT * Redis support for CRaC (#78) * wip: Redis support for CRaC - Currently doesn't work for `@Cacheable` tags - Needs manual testing with a proper app * Add base buildSrc plugin * Add config and tests * Docs * Update src/main/docs/guide/resource/redis.adoc Co-authored-by: Sergio del Amo <[email protected]> --------- Co-authored-by: Sergio del Amo <[email protected]> * [skip ci] Release v1.2.1 * Back to 1.2.2-SNAPSHOT * Fix build with missing dependencies * Typesafe project accessors * remove constructor deprecated in 1.2 * Reinstate javadoc * Update libs.versions.toml * Update build.gradle.kts * Update build.gradle.kts --------- Co-authored-by: Sergio del Amo <[email protected]> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: micronaut-build <[email protected]> Co-authored-by: micronaut-build <[email protected]>
* use Gradle Kotlin DSL * Update slsa-framework/slsa-github-generator action to v1.3.0 (#42) * ci: distribution temurin cla provenance (#44) * Update stefanzweifel/git-auto-commit-action action to v4.15.4 (#43) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * build: Micronaut Framework 3.7.4 * build: spock 2.2-groovy-3.0 * doc: eager singletons and inject HttpClient (#66) See micronaut-projects/micronaut-test#716 * ci: projectVersion 1.2.0-SNAPSHOT * ci: githubCoreBranch 3.9.x * build: Micronaut Framework 3.8.5 * build: Micronaut Test 3.8.2 * build: Spock 2.3-groovy-3.0 * wip DataSourceResolver * Convert Delegating datasource and filter non-hikari contents * Test * Test to ensure DBCP still works and isn't supported * Try to downgrade Jooq * remove @Inject BeanContext ctx * Simplify composite (#73) * Simplify composite * Extract common code to method --------- Co-authored-by: Tim Yates <[email protected]> * build: Micronaut Framework 3.8.6 * build: Micronaut Test 3.9.1 * ci: GitHub Actions sync * [skip ci] Release v1.2.0 * Back to 1.2.1-SNAPSHOT * Redis support for CRaC (#78) * wip: Redis support for CRaC - Currently doesn't work for `@Cacheable` tags - Needs manual testing with a proper app * Add base buildSrc plugin * Add config and tests * Docs * Update src/main/docs/guide/resource/redis.adoc Co-authored-by: Sergio del Amo <[email protected]> --------- Co-authored-by: Sergio del Amo <[email protected]> * [skip ci] Release v1.2.1 * Back to 1.2.2-SNAPSHOT * bug: StatefulRedisPubSubConnection beans are not supported (#91) * Also destroy StatefulRedisPubSubConnectionResource beans As raised here #63 (comment) StatefulRedisPubSubConnection beans were not destroyed during checkpointing, and so we were getting connection closed errors. * Fix. There are no PubSub beans, they are all connection beans * Reduce duplication * Checkstyle... * Naming * Visibility * [skip ci] Release v1.2.2 * Back to 1.2.3-SNAPSHOT * Handle multiple named Redis servers (#92) * Handle multiple named Redis servers * Remove debug * Fix imports * Remove deprecated experimental classes and add accepted-api-changes * [skip ci] Release v1.2.3 * Back to 1.2.4-SNAPSHOT * Document checkpoint simulator, with java/groovy/kotlin examples (#117) * Document checkpoint simulator, with java/groovy/kotlin examples closes #115 * documentation for CheckpointSimulator * Java/Groovy/Kotlin docs examples * Extract documented classes to get rid of static --------- Co-authored-by: Tim Yates <[email protected]> --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: micronaut-build <[email protected]> Co-authored-by: Tim Yates <[email protected]> Co-authored-by: micronaut-build <[email protected]> Co-authored-by: Dean Wette <[email protected]>
it was found in #715 that setting eagerInitSingletons to true makes it impossible to inject an HttpClient.
This is because MicronautTest is implicitly a Singleton, so gets initialised before the embedded server.
This PR documents this fact, and provides a workaround.
Closes #715