Similar to Springboot unit test set @Configuration Properties dynamically but the context is different. In my case I have a TestContainer running a custom MySQL database that is prepopulated with a lot of data (not using the SQL batch loading approach because the data is an anonymized copy of production and d…
Spring Kafka, manual commiting in different threads
Good day collegues. I am using Spring Kafka 2.2.5 I have a listener: I do some operations and if they are succes i use Acknowledge interface to commit offset. I have a problem. While calculations are taking place in the created thread, the listener reads the message from the same offset again. Because of this…
Can a java 8 project depend on a java 11 dependency in gradle
I have a project in Java 8 and attempting to utilise a library written in Java 11. I am getting an error: class file has wrong version 55.0, should be 52.0 Is this something that is basically not possible or is there some Gradle configuration which allows a Java 8 project to use a library written and compiled…
error:Failed to execute goal com.google.cloud.tools:jib-maven-plugin:0.9.11:dockerBuild dockerizing JHipster-Registry
When I run this command: in jhipster-registry standard project, to dockerize this application, I get this error: The link suggested in Help1 is: https://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException Answer This is a “generic error message”. My solution is: This clean the docker …
Using Lambda and Streams in For each and returning result
i am have been learning lambda and streams lately and have kind of been thrown into the deep end really early. I currently have an array list of books, a user types in a word and if the word equals the books author or title, the books toString(all attributes of the book nicely formatted) is called and returne…
Lombok @Builder not recognised by IntelliJ
I updated IntelliJ IDEA to version 2018.2.7, and Lombok’s @Builder annotation is not recognised anymore. The project already had Lombok annotations, which worked fine with previous (2017…) version of IntelliJ. Only @Builder is failing. I am using Lombok version 1.14.4. And Java 11. The problem is …
Cannot use setArray JDBC (integer) with H2 Database
I want to put an array of integers in my jdbc query with H2 database. But doest not work, I am getting this exception : org.h2.jdbc.JdbcSQLException: Data conversion error converting “(1,2,3)”; SQL statement: I am using H2 database. Can you help me please? Answer Using my JDBC utilities to work wi…
How to save the matrix in the text file
I just want to input the matrix in the text file, but the result are clearly different. I don’t have any ideas. I expect but in the file is Answer You can try this: This will print the values like a table:
Proper way to close an AutoCloseable
What is the most reliable pattern to follow when closing an OutputStream, ServerSocket, or other object that implements the AutoCloseable interface? Should I use try-catch-finally? Or a shutdown hook. Answer The correct way to use an AutoCloseable instance is with a try-with-resources block, so the resource i…
JSON Custom response in all my REST API, I might not know what it is called?
So the problem goes like this, for all my REST API endpoints there should be 3 fields always there in my RESPONSE Body like for eg: or So you can get the idea, I want this message status error or data field to be there in all response in my REST API. Answer It could be achieved with a ResponseBodyAdvice: