Skip to content
Advertisement

Tag: java

javax’s @Valid annotation usage scenario

Is it possible to use @Valid (javax.validation.Valid) in below scenario? Here JsonStringToObjectConvertor is taking in JSON in form of String and mapping it to IncidentModel class. I have defined few validations in IncidentModel in below manner and I want to validate the fields mapped by ObjectMapper in IncidentModel before proceeding further: It does not seem to work in the above

Java program uses wrong locale when jpackaged

I am parsing strings representing German-style numbers (i.e., decimal comma and optional full stop for grouping thousands), e.g., “2.804,13”; this is just done using a DecimalFormat based on my desired Locale: This gives the desired output, e.g., when compiled and run from the command line: However, when I bundle it as a jpackage image (./gradlew jpackageImage using Gradle and the

How to handle Docker-Secrets in application.properties files

How do you inject Docker secrets (files/data from /run/secrets) into the application.properties files? Is it safe to use environment variables? Answer First of all, usage of environment variables for secret data for the application.properties isn’t safe. You have mainly two options when talking about Secrets. If you are using Docker Secrets without Docker Swarm then you can directly load the

Put sin on segment in 3d

i need to put a sin function, or any other function on start of segment in 3d space. Something like that: Example But in 3d space, help me pls, i spent about 4 days for solving it, but did not get result There are 2 points in space at arbitrary positions. I need a sinusoid between these two arbitrary points.

Use another MapStruct mapper only inside an expression clause

I have a mapper that, for a particular attribute of the target class, needs to choose one from a list of objects inside the source object, and map it using a differente mapper class. Simplifying it a lot, the Game class contains a list of Transaction objects, and my GameMapper class looks like this: The thing is, EventMapper gets generated

What Happens when a thread doesn’t throw an exception?

I notice, in this javadoc, https://docs.oracle.com/javase/7/docs/api/java/lang/Thread.UncaughtExceptionHandler.html that an UncaughtExceptionHandler is used for when an exception occurs but is not caught. But, will that thread fail quietly? I guess so, because it is going about its business asynchronously, but I’m investigating a related issue with one of our processes, and am surprised at only being aware of this now, 10+ years

Batch File creation for selenium project

I need to create a .bat file to execute my selenium project that i created with TestNG. I created the .xml file: The problem is i have two @Test and for some reason he executes them as if in the same time since when he tries to login he puts the login values twice. for reference this is my .bat

Advertisement