Category "java"

How to test a repository with a user that have update rights and the test needs tot add records to the database

I use mysql and spring 5, spring-data-jpa and spring-boot and JUnit5. This must be a common problem but I don't see te sollution. I have to test a repository wi

SpringBoot Sleuth/Zipkin Tracing: Issue adding a client, for Zipkin Server

Small question regarding a Java 11 + SpringBoot 2.6.7 web application, in the context of Zipkin please. I have a very simple micro services architecture SpringB

Set Java/JRE default settings which can be overridden by JAVA_TOOL_OPTIONS

I have multiple java spring boot services, which are running in docker containers and are configured via docker-compose. Each of those services need several jav

How to apply test-driven development for storing data on db?

Let us assume that the next feature that I have to develop is to store some data on a database. Following the TDD paradigm, I have to first write a failing test

Java Time & Rest API

I’ve red multiple articles and discussions and still I have some uncertainty: I’m not sure if I should use Instant or any other type to store Bookin

My Junit5 Test class not running, package XXX does not exist error

I have a maven project setup as normal: src/main/java/a/b/c/MyApp src/test/java/a/b/c/MyAppTest I am having a weird problem in IntelliJ, where my junit5 test cl

SpringBoot Sleuth/Zipkin Tracing: Issue adding a client, for Zipkin Server

Small question regarding a Java 11 + SpringBoot 2.6.7 web application, in the context of Zipkin please. I have a very simple micro services architecture SpringB

NullPointerException when MockMvc performed in unit test

I'm trying to write a Java unit test but not sure where I'm going wrong. Likely a lack of understanding. This is my test so far: @Test public void getURL() thro

How to read XFA form field and data in Java and how to convert XFA form PDF to normal PDF

I need to read XFA PDF form filled data in Java. And also we need to convert the XFA form PDF to normal PDF.

Time Format String

I am trying to decode the date-time receiving from my APIs in my required format "yyyy-MM-dd" I receive time in 2 format 1. "2022-05-05T11:32:12.542Z" 2. "2022-

How to exclude referenced libraries from being exported when you export jar in VS Code for Java project (no build tool)

I have a Java Project for a JavaBean (multiple classes in a single project) with no build tools. In eclipse, I can export this project as JAR and I can select t

context.createDatabase is not finding in preferences DataStore Android

I've just implemented Preferences by Android DataStore but I can't find "context.createDataStore" I added this dependency below implementation "androidx.datas

How to identify the source of a context object in android java?

Overview I am working on android application in java. I have Products which can be viewed as a list by customers and vendors. Problem I want to be able to utili

Is there a @LastAccessedTimestamp in JPA

I want to store the last read time in a Date column when ever someone tries to load or fetch(select query, findBy methods) a entity I had a look at @PostLoad as

Make String.format("%s", arg) display null-valued arguments differently from "null"

Consider the custom toString() implementation of a bean: @Override public String toString() { String.format("this is %s", this.someField); } This yields

My PrepareInterceptor is being executed many times with null fields

I'm trying to use my PrepareInterceptor to see if my B2BUnit is receiving addresses, if not I want to set the B2BUnit as not active. This is my code; @Override

cannot delete list elements

I am making space invaders in Java. I am trying to get lasers to work but whenever I remove a laser the timer (that the code is in) stops. I don't understand th

Cannot align in a cell the text on the left and Icon on the right

I am trying to achieve a very simple thing, I tried different options but none seems to work. I have a simple JTable, in a column I use JLabel in order to show

On a Sunmi K2 Terminal how can I print (on the build-in printer) something using WinDev Mobile?

I'm using a Sunmi K2 POS Checkout Terminal running with Android 7.1.2 I'm developing a POS software with WinDev for Mobile 26, I'm already displaying some windo

Android Studio app crash when paho mqtt eclipse client connect [duplicate]

My Android app keeps crashing only in Android 12 when i want to connect to the mqtt server. What can i do. I tried this solution:Targeting S+