I am a beginner in java spring-boot when I start the java server through nohup java -jar demo-0.0.1-SNAPSHOT.jar command my threads start their operations After sometimes when I stop my server using kill -9 processid So my running thread data are lost. I want to maintain a thread flag in the database whenever…
Tag: java
How to upload files >32mb via Google Cloud Run
I implemented a Cloud Run process in Java with Spring Boot which consumes file uploads via HTTP. The uploaded files are sometimes over 32 MB in size. I know that 32mb is the fixed single-request limit under Cloud Run. The documentation of Cloud Run mentions two approaches to support the upload of larger files…
Use H2 as test DB in JUnit5
I’m developing an app in Spring Boot. I use a PostreSQL DB for production, and I want my JUnit 5 tests to run on a H2 memory DB. Problem is, after some configuration, the tests still don’t seem to run on the in-memory db: I can access entities from the prod db (a saved entity doesn’t persist…
Is there such a query for mongodb?
I need to do a query on mongoDB due to I am developing in Java with Spring Boot and MongoDB. I know that this command is for arrays: This query let me to find if all fields of the arraylist “skillsOfCV” are in the arraylist called “skills” However, I am trying to pass an arraylist as &…
How to solve the @Bean required error while implementing JWT token
I am trying to do an authentication web API using spring boot. I have used spring security and JWT token methods to build this API. But at some Extent I get this error: Here is my JwtFilterRequest file: Here is my JwtUtils file: I tried adding @Bean annotation at the area and it throwed an error again that it…
Do a task with interval in a loop
I already saw many question here but nothing worked for me. I wanted to set the text in a text view after every 1 second. This is what I tried: This does the task immediately and only the last number is seen. Then this: in this the screen shows blank white and after 90 seconds, I see the last number.
How can I collect two-dimensional Array into a Map<String, Set>?
I have an array of arrays of two strings. How can I collect the above array into a Map<String, Set<String>> whose key is the first element of each array and the value is a set of second elements of the array? So that I get following map? So far, I found I can classify the first element of each arr…
Are objects inside a static list eligible for garbage collection?
I know that static variables are not eligible for garbage collection for as long as the class is loaded but i was wondering if that is the same case for it’s object contents. I have this static List which contains a class object references. Are “someObject” eligible for garbage collection if…
Is instantiating an instance of an abstract class a runtime or compilation error?
From my understanding, no objects are instantiated in compilation time. Hence, the error should be classified as a run time error when the instance of the abstract object is created in runtime. Am I correct or will such an error be picked up by the compiler before runtime? Answer The work of compiler basicall…
Running JAR from BAT file cannot find natives path
I am running my JAR from a BAT file on Windows 7 x64 machine. Lately I added native .dll files to project, so now I need to add the path to the BAT. My project is exported to “C:/dist” and folder with native libs called “natives” placed alongside, that is “C:/dist/natives”.…