Skip to content
Advertisement

Tag: spring

Db insertion row if not exist spring boot

I have a two instances of one spring boot microservice. If two requests are sent at the same time, and the second request can update the row that was created by the first request. How i can prevent this? For example the table contains this columns :id,format,username,groupName and if a row exists (3,”test”,”test”,”test”) and if we try to insert another

How to define a bean from a dependency class as @Primary in Spring?

I have a Kafka Consumer and I’m implementing it using the Spring Cloud Stream Source.class binding and InboundChannelAdapter. This Source.class defines 3 MessageChannel beans: output, nullChannel, and errorChannel. My code looks like this: I want to autowire in the output channel so that I can use it to start and stop my InboundChannelAdapter manually, but I’m getting this error when

Hibernate Native SQL returns some nulls instead of partially filled objects

I have the following (postgress) SQL Query: And what it does is it creates a series of 6 hours per day and takes averages from it. A result may look like this: variable_id date_time sample_count sample_period_ms min_value max_value value 15 2021-06-06 06:00:00 120 59577 -1.4960686 1.1995025 0.30439844254136744 15 2021-06-06 12:00:00 120 59577 -1.4887594 1.1997863 0.30570657099738263 15 2021-06-06 18:00:00 120 59577

400 Bad Request when using Spring Boot

I am sending a Http POST request to my RESTful API build with Spring Boot and get the “400 Bad Request” response. My POST request is made with Postman, send to with the body I want to pass the filename variable to my Java Method. My RESTful api is build in Java with Spring Boot I tried with and with

Testing a Spring ControllerMethod using Mockito which alters an entry in the db with Optional.map NullPOinterException

Im currently Testing my Controller methods. In one Method I add a Reisepunkt(travelpoint) to a Reise(travel), which is already saved inside a database. Using the generated-request.http API I can use the method to make entrys into the db. Now i wanted to write a test method just so I can get the hang of it. I always get a NullPointerException

Spring kstreams cannot get processor to work – The class ‘[B’ is not in the trusted packages

Full code: https://github.com/BenedictWHD/kstreams-example So I have a producer (data-ingest), processor (external-message-processor), and consumer (internal-message-processor (This will become a processor later once I get things working, so apologies for the naming at the moment, but it is a consumer)). The data-ingest works from what I can tell as it sends messages to the topic external_messages. The external-message-processor attempts to read from

Advertisement