Category "java"

How to use #pact maven plugin to verify a provider without port

Per https://docs.pact.io/implementation_guides/jvm/provider/maven/#2-define-the-pacts-between-your-consumers-and-providers : Protocol, Host, and Port are requir

Get StateContext in @OnTransition annotated method

In the Spring Statemachine reference doc is this sample code: @WithStateMachine static class Bean1 { @OnTransition(source = "S1", target = "S2") publi

Could not transfer artifacts from/to central maven repo when using Spring Framework Cloud

I am trying to create a maven project using Spring Framework Cloud. I defined pom.xml file as below <parent> <groupId>org.springframework.

Unresolved compilation problem exception using JOptionPane

I am a beginner in Java and I am trying to use JOptionPane to display a message box but keep getting stuck with an error which I cannot figure out. This is my c

Could not transfer artifacts from/to central maven repo when using Spring Framework Cloud

I am trying to create a maven project using Spring Framework Cloud. I defined pom.xml file as below <parent> <groupId>org.springframework.

Merging 4 sorted Arrays into one

I have this method to merge 2 sorted arrays into one sorted array: public void merge(T[] a, int l1, int r1, T[] b, int l2, int r2, T[] c, int l3) {

Unresolved compilation problem exception using JOptionPane

I am a beginner in Java and I am trying to use JOptionPane to display a message box but keep getting stuck with an error which I cannot figure out. This is my c

FindIterable<Document> how to get total records in a result of a query

I was using mongo driver for java 2.x and passed to 3.1. DBCursor is deprecated and I had to use the FindIterable<Document> structure. When I perform a q

Why is SQL Server sequence jumping by two when fetched from Java code?

Let's say there is a sequence created on SQL Server: CREATE SEQUENCE dbo.my_seq START WITH 1 INCREMENT BY 1 NO CYCLE; GO And the following Java cod

Spring Boot can't autowire @ConfigurationProperties

Here is my FileStorageProperties class: @Data @ConfigurationProperties(prefix = "file") public class FileStorageProperties { private String uploadDir

FindIterable<Document> how to get total records in a result of a query

I was using mongo driver for java 2.x and passed to 3.1. DBCursor is deprecated and I had to use the FindIterable<Document> structure. When I perform a q

Programmatically call spring cloud config actuator/env post endpoint in spring boot application

I am using spring cloud config in my spring boot application, I am trying to update the property value through actuator/env post endpoint. Here is my code: @Ser

explanation of variable setting formula in Java required

i have this java code: weight = weight == 0 ? 1 : weight; Can anyone please explain what will happen to variable weight in all cases?

Spark on Windows - java.lang.UnsatisfiedLinkError: org.apache.hadoop.io.nativeio.NativeIO$Windows.access0

In Win10, in IntelliJ this path("C:/hive/Orders_[0-9]*.csv") works good when run as stand alone java spark job. But not working as Spring Boot spark job. Seems

JOOQ - equivalent of hibernate interceptor for populating history fields?

Environment: Spring application, using JOOQ 3.7, generating the JOOQ mapping code automatically from the schema, using Postgres as my database. I've been porti

how to read json array from servlet to jsp

JSONObject,jsonarray cannot be resolved to a type servlet: while(rs.next()) { JsonObject jo=new JsonObject(); jo.put("id",rs.getString(1));

How do I run a gui Java application headless, without control of the source code?

I want to execute a Jar file using javax swing GUI with 1 radial option, a file selector and a button. The goal is to be able to automate the jar through CLI an

Google Map is not showing in Android Studio (Only Google Icon is Visible)

I want to import Google Map SDK in my project. According to Docs I follow all the steps perfectly but when i run the project it only show an icon of google inst

Run Java Selenium tests in Azure DevOps release pipeline

I'm doing a POC for a Java project in an AzureDevops CI/CD pipeline. I created a Maven project that has Selenium tests (TestNG) that run against a demo website

Switch JDK version in Windows 10 cmd

Is there a way to change JDK version easily in cmd? like the version on mac. Change Default JDK on Mac.