Skip to content

feat(dependency-injection): lifecycle — PreDestroy, custom scopes, scope violation detection#33

Merged
deer merged 1 commit intomainfrom
di_lifecycle
Apr 14, 2026
Merged

feat(dependency-injection): lifecycle — PreDestroy, custom scopes, scope violation detection#33
deer merged 1 commit intomainfrom
di_lifecycle

Conversation

@deer
Copy link
Copy Markdown
Collaborator

@deer deer commented Apr 14, 2026

  • @PreDestroyContext now implements AutoCloseable; close() invokes @PreDestroy-annotated zero-arg methods on all instantiated singletons in reverse topological order (dependents destroyed before their dependencies), derived via Graphs.topologicalSort
  • Custom scopesScope / ScopeAnnotation / ScopedValueScope: a @FunctionalInterface scope API backed by ScopedValue (virtual-thread safe, leak-free); register via InjectionFramework#bindScope
  • Scope violation detection fixvalidate() now also flags @Singleton depending on a custom-scoped binding (previously only caught singleton → prototype); names the scope annotation in the error message (e.g. depends on @RequestScoped-scoped [...])
  • findScopeEntry — refactors findScope to expose the full (annotationClass, Scope) entry, enabling CustomScopedClassBinding to carry the scope annotation for introspection

@deer deer merged commit 74ffa96 into main Apr 14, 2026
1 check passed
@deer deer deleted the di_lifecycle branch April 14, 2026 09:24
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.

1 participant