Skip to content

Update conversion doc - #268

Merged
cstamas merged 7 commits into
mainfrom
coversion-doc
Jul 27, 2026
Merged

cstamas merged 7 commits into
mainfrom
coversion-doc

Conversation

@cstamas

@cstamas cstamas commented Jul 26, 2026

Copy link
Copy Markdown
Member

Make clear that JSR250 annotations are not required, if user is ok to use Sisu provided ones instead, that has same semantics. Also, some cleanup done as well.

Make clear that JSR250 annotations are not required, if user is
ok to use Sisu provided ones instead, that has same semantics.
Also, some cleanup done as well.
@cstamas
cstamas requested review from adreghiciu and kwin July 26, 2026 12:03
@cstamas cstamas self-assigned this Jul 26, 2026
@cstamas cstamas added the documentation Improvements or additions to documentation label Jul 26, 2026
@cstamas
cstamas marked this pull request as ready for review July 26, 2026 12:05

@HannesWell HannesWell left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The example to replace Disposable without lifecycle annotations is very helpful.
But I wonder if the List injected into MyLifecycleParticipant is updated if new MyDispoosable instances are created later.
As far as I understand it Sisu is in general lazy.

cstamas and others added 3 commits July 26, 2026 22:39
Co-authored-by: Hannes Wellmann <wellmann.hannes1@gmx.net>
Co-authored-by: Hannes Wellmann <wellmann.hannes1@gmx.net>
Co-authored-by: Hannes Wellmann <wellmann.hannes1@gmx.net>
@cstamas

cstamas commented Jul 26, 2026

Copy link
Copy Markdown
Member Author

The example to replace Disposable without lifecycle annotations is very helpful. But I wonder if the List injected into MyLifecycleParticipant is updated if new MyDispoosable instances are created later. As far as I understand it Sisu is in general lazy.

Yes, sisu is lazy, and injected collections (List, Map and Set) are "live" collections, in a way, if new component is discovered, the collection is atomically added, and if unloaded, is remeoved.

If properly scoping (not unload then dispose), it should work.

}
```

Alternately, users can define their own lifecycle interface, and use that by injecting those into some component that has access to lifecycle

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I would rather suggest reusing AutoCloseable in order to allow usage of try with resources.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@cstamas cstamas Jul 27, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I would never do something like this in any of app I author:

@Inject
private List<AutoCloseable> closeable;

as this interface is not "dedicated" to app, but is free for all, and you don't know who used it for what. If we talk about some "set of libraries", take Resolver SPI is for example. Best (and safest) is always to introduce specific and dedicated type for use case. If you want to cooperate, than introduce some sort of SPI or shared APIs and use that. But Java built in types being injected is a no-no for me.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Re Cleaner, the doco merely shows the idea, strategy, and how it is implemented by users is totally different thing IMO.

@kwin kwin Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I would never do something like this in any of app I author:

@Inject
private List<AutoCloseable> closeable;

as this interface is not "dedicated" to app, but is free for all, and you don't know who used it for what. If we talk about some "set of libraries", take Resolver SPI is for example. Best (and safest) is always to introduce specific and dedicated type for use case. If you want to cooperate, than introduce some sort of SPI or shared APIs and use that. But Java built in types being injected is a no-no for me.

Right, maybe then just suggest extending it. Does Sisu always register all (transitive) interfaces or just direct ones?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Sisu injects any discovered bean (from index or discovered by any other means, as configured) that are type-wise applicable. Extending it is okay, point is to create dedicated type to avoid any possible problems.

Co-authored-by: Konrad Windszus <konrad_w@gmx.de>
@sonarqubecloud

Copy link
Copy Markdown

@cstamas
cstamas requested a review from kwin July 27, 2026 12:28
@cstamas cstamas added this to the 1.1.0 milestone Jul 27, 2026
@cstamas
cstamas merged commit f32a35e into main Jul 27, 2026
14 checks passed
@cstamas
cstamas deleted the coversion-doc branch July 27, 2026 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants