Category "spring"

Difference between @Mock, @MockBean and Mockito.mock()

When creating tests and mocking dependencies, what is the difference between these three approaches? @MockBean: @MockBean MyService myservice; @Mock: @Mock

Got bad greeting from SMTP host: smtp.yandex.ru, port: 465, response: [EOF]] with root cause Yandex

I use brand new spring boot project with next Maven dependency <dependency> <groupId>org.springframework.boot</groupId>

Mixed Content error because of Keycloak default login redirection

INFORMATION NEEDED: I use Keycloak (Docker version) behind a Spring project. (The client side of this project is React and communication between client and ba

How to add scheduled job to all nodes in java springboot cluster?

We have two springboot servers. We use nginx so that the user request will be sent to one of the server node. Now we want to achieve that: After user inputs thr

How to use math.max in thymeleaf to find maximum number?

While trying to use max function in thymeleaf I got OGNL expressionn everytime. I'm not even sure if we can use functions like max/min in thymeleaf. Tried to lo

How to add headers(autherization header) in Prometheus.yml file while configuring spring application

Running my application on localhost with this url -> http://localhost:8081/my-service-name After configuring prometheus, I am getting the metrics on postman

Apache Camel: MethodNotFoundException, Failed to invoke method on null due to: MethodNotFoundException

I try following a video tutorial for Apache Camel education and trying aggregate queue objects in a next way: @Component public class AggregationRoute extends R

JSONObject always returns "empty": false

There is a Spring Rest Controller : @RestController @RequestMapping("secanalytique") public class SectionAnalytiqueController { @GetMapping(value = "/sect

CustomDeserializer has no default (no arg) constructor

I am consuming a REST Api with RestTemplate. The response I'm getting from the API has lots of nested objects. Here's a little snippet as an example: "formular

Getting a 400 bad request response when submitting a form in Thymeleaf to my spring boot application

I am creating a Spring boot application with a thymeleaf front-end. I am trying to create an object of type "expense" (seen in the code snippet below) but, when

Send an image in the mail using thymeleaf

In my application I would want to send emails using javamail. I use Thymeleaf so that I can send some data. When sending the email, I want the background to be

How to call repository method in entity listener

I'm trying to make call to repository inside my Entity Listener, when I call repository.findById() method inside my @prePersist method the same method is callin

Spring Boot build image failure for native image

Using spring boot 2.6.2, with java17, trying to create native image but it fails with below error. I am building it on windows 11 machine with docker desktop i

How to get image in response with postman

I have an endpoint to get the image i uploaded earlier, it works but not well I don't know if i can get the image in response my controller endpoint: @PreAuth

select query inside loop - Database connections in JPA

In my Spring MVC application, I have @Transactional annotated method inside which I make call(select query) to DAO layer inside for loop. If my input list size

Jetty: How do I protect unpack war file [closed]

I developed web that deploy ROOT.war through jetty(windows10) and I will deploy that to my client but I don't want to who modify my unpacked w

Is it possible for TestNg to show Cucumber Steps (And Hooks)

I have a project with Gradle + Cucumber + TestNG + Spring. Everything is with last versions and runs smooth. The only problem I have is when I run tests from th

Get Request/Response Body&Header in Spring AOP

I want to get request/response body and header within my aspect before and after if it's available or how to get those . I mean i think with before annotation

Spring Data JPA / Hibernate "Unable to locate Attribute with the given name"

We have a problem with a Spring Web Application and Hibernate. It is written in Kotlin. We have an abstract Entity @Inheritance(strategy = InheritanceType.JOI

How to access nested Json Object Value into JPA Entity Class

I have a payload like this { "eventId":"ep9_0579af51", "eventTime":"5/11/2022 5:50:58 PM", "eventType":"UpdateTransaction", "meta":{ "us