Skip to content
Advertisement

Tag: spring-boot

Spring data elasticsearch: Using @Document annotation on POJO interface class not working

I am migrating an application to the latest spring-boot version (using maven spring-boot-dependencies with version 2.5.4). I have an interface called Customer and I have two implementations of that interface (BusinessCustomer, PrivateCustomer) The three classes are annotated like that: For querying the index “customers” I used to have code like: But this is not working anymore. I get an error

How to test Service method with ModelMapper call

I’m writing some Unit Tests for my Service class, specifically, an update method that does exactly that, update an Entity with the given data from a request. The problem is, I’m using ModelMapper to map the request data to the entity and when the test goes through the mapping statement it doesn’t actually call the modelMapper but the mock ….

spring boot starter validation simply not working

Problem: I need to validate some json inputs and outputs in my Spring API, I’m trying to use spring boot starter validation (Already know that is not into spring-boot-starter-web, so I added it manually) but it never throws the exception when something is bad based on the validations in the DTO class (MethodArgumentNotValidException) Complete project can be fonud on github

Spring HandlerInterceptor fire and forget

I am wondering what would be the best way to make an HTTP fire and forget web service call inside a HandlerInterceptor (or maybe there is something more suitable). Let’s say I am handling requests and I want to notify some API for each response resulting with HTTP 5XX (by sending the request and response body of the request). Of

Spring boot filter is ignored

I m trying to create a filter, but it is ignored Did I forget to do smth? Answer The problem was in the absent of pom dependency Instead the Filter was loaded from some java library and therefor compilation was successful (can be removed in module settings)

Why this error trying to unit test an entire Spring Batch Job? No qualifying bean of type ‘org.springframework.batch.core.Job’ available

I am working on a Spring Batch application. Untill now I was able to unit test something like service methods and something like this (as done in every Spring Boot application). Now I am trying to follow this tutorial in order to test an entire job from my unit test class (basically I want to execute a test method that

Could not transfer artifact com.squareup.okhttp3:mockwebserver:pom:4.9.1 from/to central (https://repo.maven.apache.org/maven2)

I have encountered a problem while importing the MockWebServer dependencies into my project Idea is showing 2 problems: Dependency ‘com.squareup.okhttp3:okhttp:4.9.1’ not found Dependency ‘com.squareup.okhttp3:mockwebserver:4.9.1’ not found And reload all maven projects results in a big “stacktrace” which generally says that it can’t resolve any of the dependencies. Running maven goal compile results in an error: Could not transfer artifact com.squareup.okhttp3:okhttp:pom:4.9.1

Advertisement