I have an api that has several methods. The workflow of the api call is in general like this: login, callX, … and logout. Each api method is doing calls to subsystems. The trace id with sleuth works for e.g. the login call and all it’s subsystems. Now i would like to have a trace id that is the sa…
Tag: spring-boot
In which cases does JpaRepository automatically create the query without you having to use @Query annotation
I am following a Udemy tutorial in Spring boot. There’s a part where @Query wasn’t used for a user-created method in the repository interface. It works, but I want to understand when JpaRepository takes care of the creation of query. In the User class below, @Table wasn’t used. findByEmail(S…
What is the recommended way of overriding version of a dependency from parent pom?
I want to override the bouncy castle version from the parent POM. I know we can add the dependency explicitly like so: But this is not the recommended way, the recommended way is adding the version in the properties part of the POM, but I can’t seem to find the name of the version property for Bouncy ca…
Error when running springboot with Cucmber and Serenity
I am trying to test my spring boot application using serenity-cucumber. To do this , I have my entry point: Then my Baseclass to be used by step defs, And , one of my step defs is running some dummy tests at this point to work as glue. My feature class: I have imported the following dependencies, (have also t…
How to map a CSV to Object with List using CsvMapper?
I’m trying to map a Csv file to an Object what instances List of Objects using CsvMapper, is that even possible? Example: Content of Csv file (without header): Field 1: name Field 2: gender Field 3: hobby (List comma separated) Field 4: relation Example class: Thank you in advance. Answer I found myself…
How to store Form data in a H2 Database (currently works using POSTman, but not the website form)
I am just teaching myself the Spring framework and am trying to makie a simple library app which stores user (book) inputs in a form in the H2 Database, and then shows the user the newly inputted data from the H2 Database. Form submission attempt 1: I now have a working POST method which correctly saves a new…
SpringBoot – @Transactional – not opening transaction
I am trying to use transaction in SpringBoot app , for some reason it just doesn’t work. Below is the code for the sample app. I have a rest api in MyRestController.java which invokes DBService.hello() method. In hello() method I insert a row into a table using JOOQ. I see transaction is NOT being creat…
Problem in running application with Vaadin and Spring (MySQL DB)
I am trying to connect a Vaadin project to a MySQL database following the instructions I found here: https://dzone.com/articles/how-to-connect-a-mysql-database-to-a-vaadin-applic I downloaded the ready project in the article (also available here: https://github.com/Liskokuningas/databasemysqlexample) I, then,…
How to set TotalPages of a PageImpl class in spring boot
I’m converting a Page to a new one by using PageImpl class, but the totalpages attribute has the default value 0. I would like to set totalPages to a specific number. Is it possible to change it? code Answer To get a page as an answer you need to change a line in your code Case 1 To find maximum
i.grpc.internal.AbstractClientStream – Received data on closed stream meaning
I have a Spring boot application (v2.2.10.RELEASE) that subscribes to multiple topics in pubSub and pulls async data and sends it to somewhere else. I am not using SpringGCP, just native google libraries this is my subscriber setting: With high traffic and big messages (2 – 4 kb) I encounter this info m…