Skip to content

Incomplete @PreDestroy support, @PreDestroy should be supported wherever @PostConstruct is supported #959

@raisoftware

Description

@raisoftware

@PreDestroy should be supported wherever @PostConstruct is supported.

  1. // @prototype scoped bean does not support @PreDestroy lifecycle method
    This is wrong. @prototype is orthogonal to @PreDestroy.
    Consider creating a UserSession object in the login() method. We need it to be a new instance, without losing all the lifecycle benefits granted by the framework.
  2. "@lazy scoped bean does not support the @PreDestroy lifecycle method"
    This is also wrong. @lazy is orthogonal to @PreDestroy. Beans should be lazy initialized for the large majority of cases, for correctness reasons as well as performance reasons. For example, this is how Micronaut works.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions