I’m currently developing a Spring-based web platform which makes use of several scheduled processes that access a central database. I wanted to introduce actuators for shutdown and restart. However, I am experiencing an issue: even though the shutdown request is accepted with a 200 response, the application context begins shutting down: And after that, I repeatedly get the following exception:
Tag: spring
MapStruct adding 1 suffix to object
I am using mapstruct to map my DTO to entity, My Entity My DTO Generated MapStruct Implementation I tried editing the file but it is unable to create break and always gives break1 Answer Break is a reserved keyboard, use different name or it would always add 1 suffix for successful compilation.
Database entry problem. Only null value is written
I’m trying to work with REST api and after creating JSON post call, null value is written to the database instead of the value that was written in JSON. I am working with PostgreSQL database. After I send JSON using Postman or Swagger I get Server Response Code: 200. But the database writes the color as null. EXAMPLE: JSON: Server
INTERVAL expression in Spring Data JPA Native Query
I have Spring JPA. I have a query like this in sql oracle: I have a CrudRepository in which I use the above query in native mode, like this: I get ORA-00933: Passing myValue as integer between quotes I get ORA-01867 Passing myValue as integer without quotes I get ORA-00933 How to do it? Answer See comments on question, there
Field “” in “” required a bean of type “” that could not be found
I’m struggling through a Spring Web API tutorial, using STS4. I got to the state in the tutorial where I need to test it, but I just got a “not found”, so the routing doesn’t seem to be working. I saw online comments that seem to suggest I need a @ComponentScan(“com.example”) adding to the main() function, something not mentioned in
How to search in parent entity scope when using spring boot data rest
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
Starting Spring Boot application (Vaadin) stuck at running ‘npm install’
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
How to read files from the sub folder of resource folder with using toURI
How to read files from the sub folder of resource folder with using URI I have some json file in resources folder like : Now I want to read this in my class which is here is what I am trying. my things are working fine but the problem what I am getting is i don’t want to use toURI
Error in getting image from Graph API in spring-boot with resttemplate
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
Java spring hibernate JPA @ManyToAll findAll() slow on large data, many subqueries created
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