if we have a Product and Supplier object, where Product has a supplier and a supplier has a Product, how can we indicate to the entities that this is not an infinite cycle when obtaining the JSON of a product? this would be something like how could we configure this in java with JPA by levels? so that it is
Tag: spring-boot
How do I execute a docker container
I created the images locally and created one repository in DockerHub called testName/backend. The docker images command shows the created images. And I would like to run the container with a command in the format docker run yourImage:version. So according to this (so I think I should call such a command: dock…
SqsListener doesn’t pick up any messages from SQS Queue
I’m trying to implement a queue through SQS for my project, sending to the queue works just fine, but receiving from the queue isn’t working at all. It seems the receiver has absolutely no connection to the queue at all Config Consumer Method Maven Dependencies I’ve gone through numerous Sta…
Spring-Boot When running .JAR of project it fails to initialize JPA
What I want to achieve is that when I push something to my staging branch on github a script on the Ubuntu server automatically pulls the branch, compiles the project and runs the .JAR file. But I’m facing a problem where if I package my project on Ubuntu it fails to initialize JPA EntityManagerFactory.…
Propper way to describe request body as java class
What is the propper way to describe json body like this in spring-boot app? For now i have class like bellow, but i have problem with serialization of mpa and genres fields. Genre and Rating: Answer Jackson ObjectMapper cannot create the object, because neither default constructor exists nor any other creator…
Log4j2 log file not created
For a spring-boot application I’m trying to set up a log4j2 logger that will write the logs into a few sperate files, but the logs are only written to the console, I’ve checked my user_dir to make sure I’m not looking in the wrong location as well. This is the code that should write the test…
Spring boot won’t connect to Postgres database
I am trying to learn Spring Boot with a tutorial. I have the code and the database, but I keep getting a Hibernate ERROR whenever I try to connect the two… This is the Error I get: I have the dependency set up in my pom.xml: The StudentService And the StudentController class application.properties: Unfo…
Ldap AD Authentication in Spring Security
I have a login page in my application where I want to validate the entered username/password against Ldap AD. I am thinking of creating a bind and get a context. If bind is successful that means user is authenticated. In Java I have achieved it like this: Above code is perfectly working for me. I want to impl…
Spring @PostMapping force null values for formdata urlencode?
When I run the following request, the values in my received object are not null, but “” empty: Question: how can I tell Spring to not add empty values on Strings, but keep them null? Answer Could solve it as follows: This converts any empty strings to nulls.
Implement Elasticsearch aggregation snd sort query using Java API and sort based on reversed
I have an Elasticsearch nested aggregation query(below), that I am trying to implement in Java using the Elasticsearch Java API. The query counts keywords and sorts using the reversed_nested _count. The query works in dev tools and partly Java, the only I can not sort using the Java API using the reversed_cou…