-
Notifications
You must be signed in to change notification settings - Fork 445
Micronaut example: add Kotlin version, extended description of Micronaut use #1232
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
Conversation
|
I would prefer to keep the example injected service. They illustrate that services can be injected thanks to the factory that enables dependency injection. The business logic is omitted, so it is not clear how they are used, that is true. Perhaps we can clarify a little by adding a comment? @Client("https://api.github.com")
@Inject RxHttpClient client; // example injected service
...
public void run() {
// business logic here
// injected services can be used here
} |
Codecov Report
@@ Coverage Diff @@
## master #1232 +/- ##
=========================================
Coverage 94.33% 94.33%
Complexity 455 455
=========================================
Files 2 2
Lines 6686 6690 +4
Branches 1799 1799
=========================================
+ Hits 6307 6311 +4
Misses 102 102
Partials 277 277
Continue to review full report at Codecov.
|
I do understand that, and in general I'm not against including these lines at all.
That's true. Without having these lines use of Micronaut is overhead without real value. My point is: without these lines, there is only single dependency for that sample: Proposal 1: we keep the lines as comments:
Proposal 2: we show and explain the example from the micronaut quick start guide. Currently, the example is quite long, we might be able to shorten it a bit. This would make obvious to the user how the injected services are used. Proposal 3: ?? (any comments or ideas for a completely different sample are welcome!). Looking forward to your comment! |
|
How about something like this: @Client("https://api.github.com")
@Inject RxHttpClient client;
@Parameters(description = "GitHub slug", paramLabel = "<owner/repo>")
String slug = "remkop/picocli";
public void run() {
Map m = client.retrieve(GET("/repos/" + slug).header(
"User-Agent", "remkop-picocli"), Map.class).blockingFirst();
System.out.printf("%s has %s stars%n", slug, m.get("watchers"));
}Unsure if we need to add details about what dependencies are needed to run the example. What do you think? |
…d description for Micronaut use
That's a great idea. I took that over into the PR 1:1.
You can use the
I think, together we could improve the sample. Thanks for your input and thanks for reviewing my PR. |
|
Merged, and published the rendered HTML. Very nice. That section is certainly a lot more comprehensive now. |
This PR adds adds the Kotlin version for the Micronaut example (chapter 22).
When working on this, I extended the description a bit.
Also, the example was sligthly altered, it now closely resembles the auto-generated sample source file.
Also I removed these lines
since they weren't used inside the sample. As a side effect, number of imports could be reduced after removal of these lines.
Feel free to polish my description!