Now I know how to findBySomething on root level entity. Let’s say I have a one to many relation of class -> student I can now students/search/findByName?name=Tom But it will give me Tom in all classes. Can I do something like classes/1/students/search/findByName?name=Tom It gives error right now. Answer in StudentController in StudentService in StudentRepository (I use mongoDB; if u use
My Vaadin application used to work fine, but now when I want to start it the application is stuck at running npm install: 2022-10-02 15:24:49.482 INFO 27004 — [ main] dev-updater : Running npm install to resolve and optionally download frontend dependencies. This may take a moment, please stand by… And I cant find a way to fix that. Thanks
I am using the graph api: to get the particular user’s profile photo with my access token. In postman I am able to see the image using the above get call. In my spring-boot application I am using like below: I am getting below error: I have defined RestTemplate like: Could someone please help me with this? Answer You need
I have 2 classes, Aircraft and Operator, with a one to many relationship from Operator to Aircraft. A findAll() call on the Operator table, which has around 10k rows, from the JPA Repository runs quickly, in just a few seconds, but the findAll() call on the Aircraft table, which has around 65k rows, sometimes takes minutes to execute. Also, I’ve
I have created a reusable method that returns the headers, status, and body of an HTTP call using the Spring webclient’s exchange method. I want to capture the 4xx and 5xx errors in the method itself and log the response body. However, i am not able to return/throw custom exception when 4xx or 5xx error occurs. Here is the reusable
I have a Spring Boot application with a YAML configuration that contains a feature list like this: I would like to use @ConditionalOnExpression to conditionally initialize beans related to those features, identifying them by keys. Since “features” property is a list, it seems I need collection selection to do this. I have tried these two options for the annotation’s value:
I have service like this: How can I run method2 without transaction or in new transaction? Can I run in my controller class this 2 method like this: Answer @Transactional is powered by Aspect-Oriented Programming. Therefore, processing occurs when a bean is called from another bean. You can resolve this problem by self-inject create another bean.
I’m using Java 17, spring-boot 2.7.3 and spring 5.3.22 dependencies. I have prototyped beans as follows: My application class: I annotated the InsertTransactionDetailsByScheduleAPIInteractor also as prototype in order to have a new instance of the inner beans per schedule execution, but somehow the @Scheduled method only runs when I have a singleton InsertTransactionDetailsByScheduleAPIInteractor bean, which in my use case I
I have an application that consumes a REST service from another server, which has its own authentication method to be able to consume its services. Today, for each request we have, I am calling the authentication service then i receivethe bearerToken (which has a duration of 3 hours) and after that I call the endpoint I want to use. The
I have an User class: And an UpdateUserDTO class: And an UserDTO class: I’ve used Model Mapper to map the updated fields from updateUserDTO to user, which comes from the DB. My test class looks like this: But the first Mockito.when() line does not even compile, because mapper.map() is a void method, so it does not expect any return values.