Skip to main content

Didier L

Brussels, Belgium

IT Architect, Java enthusiast, regular indoor climber and #SOreadytohelp

Jul
5
comment Lombok annotation @Getter for boolean field
… or you could just read the Small print in the documentation. @Andrew use @Accessors(fluent = true) or read the previous paragraph in the same documentation.
Jul
5
comment Lombok annotation @Getter for boolean field
@Getter does not have a fluent parameter
Jul
4
comment What is the best way to know if all the variables in a Class are null?
@RHronza the Spring documentation tells you that it is for internal use, and recommends to use something else (that does the same thing)
Jul
3
comment How to maintain dependencies shared among microservices?
I have never used it myself, but OpenRewrite is a solution for performing upgrades of code automatically. But more importantly: if an API is no stable, it should probably not be part of a shared library (yet). Also each microservice should have its own database, and access other functional domains through other microservices and not their database. Then you can have a thin, stable client library for the microservice (or just use Swagger).
Jul
3
awarded Enlightened
Jul
3
awarded Nice Answer
Jul
3
comment What is the best way to know if all the variables in a Class are null?
@RHronza That one exists for internal use within the Spring framework, I would recommend using the StringUtils of Apache Commons Lang instead, as recommended by Spring’s StringUtils javadoc itself!
Jul
3
comment How to execute logic on Optional if not present?
if (!Optional.empty().isEmpty()) { System.out.println("The object is not present"); } is more compact and does not abuse orElseGet(). Similarly, the singleton pattern as shown here is better implemented as if (instance == null) { instance = new Settings(); } return instance; (but the enum approach is even easier)
Jul
3
revised Spring DATA JPA how to write a method which use contant value for a field to fetch data
edited tags
Jul
2
comment How to define query method in spring data jpa if one of the query parameters is fixed?
This question is similar to: Is there any way to use constant (EnumType Ordinal) value in @Query annotation in JPA repository?, Spring DATA JPA how to write a method which use contant value for a field to fetch data and How to use fixed values in Spring CrudRepository?. If you believe it’s different, please edit the question, make it clear how it’s different and/or how the answers on that question are not helpful for your problem.
Jul
2
revised How to define query method in spring data jpa if one of the query parameters is fixed?
edited tags
Jul
2
revised How to use fixed values in Spring CrudRepository?
Made the examples fit the width of the questions
Jul
2
comment How to handle multiple self referencing foreign keys in Hibernate
This question is similar to: Why can't hibernate lazily fetch @ManyToOne and @OneToOne?. If you believe it’s different, please edit the question, make it clear how it’s different and/or how the answers on that question are not helpful for your problem.
Jul
2
comment Java Microservice (api gateway, config server, service registry and models)
As it currently stands, the question is way too broad. You should focus on a single microservice, probably in isolation (no gateway, config server or service registry) and try to make it work on Docker. This will also allow you to provide a [mre] inside the question. See also stackoverflow.com/help/how-to-ask
Jul
1
revised change value in inner map with stream
edited tags; edited tags
Jul
1
comment How to combine multiple Collections (Queue or List) element by element?
Not a big deal but if you are using record, you’re certainly not using [tag:java-8]…
Jun
30
comment What should I do with a question if the answers all answer a subquestion that's more useful than the original question was?
Regarding downvotes, I asked a similar question some time ago and it got similarly downvoted (more than yours, but still got 8 upvotes as well). My guess is that people don’t want to do anything about such questions. I suppose that, ideally, the question should be split in two, moving each answer to the right question, but we don’t have the tools for that (even the mods).
Jun
30
comment What should I do with a question if the answers all answer a subquestion that's more useful than the original question was?
@philipxy OP should mention what they have tried though, and Y was one such thing.
Jun
27
comment Compare two dates with JavaScript
@DenilsonSáMaia Replace jsperf.com with jsperf.app to recover the old benchmarks, e.g. https://jsperf.app/comparing-date-objects. I have also added variants with < and <= for the sake of completeness, but of course it’s just doing type coercion twice so its twice as slow as the plus trick.
Jun
26
comment How can a Callable return a value from a predefined void callback?
@Holger well, yes… but then the main benefit of CompletableFuture over plain Future is that join() doesn’t throw… OTOH ExecutorService.submit() returns Future and might make more sense to use if you don’t need the complete() and chaining features. I’m curious to see what’s coming with all of that :)
1 2 3 4 5