I have 2 documents, ShopDocument and ProductDocument. What i need is to filter out all shops that have field hidden and removed equals to true, from shops that left filter out products that have removed and hidden fields equal to true, then from whats left, i want to filter out shops and products that doesnt match certain string (the matching
Tag: spring
how can i differentiate between scheduled call and HTTP call of the same function in java?
i have a get function in my microservice which essentially fetchs data from a database. this function is running as a scheduler (cron job) and also as an api end point which can be triggered from the UI. i want to add some logic inside getData() which will only be executed when it is being triggered by the scheduler and
Function expects two parameters, but definition only contains one parameter
I’m having a very odd issue, and it’s very simple but I don’t understand what the problem is. I have one class, ClassA that calls a function in ClassB such as -> Class A is a bean defined in my applicationContext.xml like >> the function definition in ClassB looks like >> public boolean sendMessage(MessageBean bean) throws MessageException { … }
Java Spring omits fields when making a JSON
I have an object that looks more or less like this, and I use it as a GET response for my API. scores and values are both database entities. I wanted to add a String to the response with some additional information. What happens is that the objects are properly turned into a JSON and they show up in the
Convert fields before sending to the page
I have a user dto class and i need to convert some of its properties before send it to frontend. UsedDto class Now, from my controller i get data like this In my case, before send data, i should convert boolean values (enabled, active) to string “Y” or “N”. How can i do this? Answer You can implement a custom
Application failed after added swagger configuration
I’m using spring boot and I want to add swagger configuration, the problem is after I run the application I get this error: In my class I added this methods: In my pom.xml I added this dependencies: I can’t understand what is wrong, I followed online solution asking me to add @EnableSwagger2WebMv and @EnableSwagger2 but I still get errors. I
Spring R2DBC Repos auto configuration not resolving dependencies
I Have the following repository: https://github.com/vlio20/bfit in which I try to use R2DBC in order to do db operations in an async manner. I followed the following tutorial (but maybe it is outdated https://www.youtube.com/watch?v=DvO4zLVDkMs Here are the relevant dependancies of my pom: I am using the default configurations, so I only have the following configuration in my properties yaml: And
How Spring Batch Step chunkSize and JpaPagingItemReader pageSize work together
Im developing a Spring Batch application. Although I’m getting more and more comfortable with it, I came across with something that is making me very confused. Please take a look at this step configuration. As you can see it’s a pretty standard step. My confusion is related to the chunk size (50) and the reader (processNonExportedMbfsOperationsItemReader). Reader code next: The
My Spring JPA queries do not work with H2
This query below does not work and it generates me an exception When I used the MySQL database, the query worked fine. But now that I am using the H2 database, it suddenly does not work. Why? How do I fix this? Answer It would be better to use JPA. If you still wanna use nativeQuery, use like this:
Spring – how to automatically insert an entity in the database when inserting another (One-To-One relationship)?
Hi fellow software developers, Let’s assume we have the following scenario: we have a system where drivers can register. Each time a new Driver registers, the system automatically builds and assigns a Car to the driver. Let’s consider we have the following rest controller which exposes an endpoint for the drivers to register in the system: How would you Actually