Category "java"

Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=...) with your test

I am using Spring Data JPA and Spring Boot. The layout of the application is this main +-- java +-- com/lapots/game/monolith +-- reposi

Passing a DTO and other values in @RequestBody in Spring

I want a pass a dto and another value using the @RequestBody in spring. Something like shown in below,(This is my controller code) public User createUser( @Req

Clean way extract path parameters from Camel HTTP endpoints

Ideally I would like to have a route like this: from("jetty:http://0.0.0.0:8080/{pathParam1}/{pathParam2) So that a consumer would then be able to access the

Adding borders to GridPane JavaFX

I am creating a board game in JavaFX using GridPane. There are 7 different animations which could be placed in each grid (cell) of the grid. Initially the gri

Hibernate mapping classes from hibernate.cfg.xml

For class mapping from hibernate.cfg.xml I use these format below: <mapping class="packageName.className1"/> <mapping class="packageName.className2"

Is there a way to save Cloudlet output to a csv file?

I'm working on a project using CloudSim simulation tool for masters. I want to know how to save the output of the printCloudletList to a csv file in NetBeans. A

Google play java.lang.NullPointerException

I have an app with 100 installs done but I have 2 error on java.lang.NullPointerException; the thing is that when that error came in my device or emulator I cou

Do lambda expressions have any use other than saving lines of code?

Do lambda expressions have any use other than saving lines of code? Are there any special features provided by lambdas which solved problems which weren't easy

why does tomcat show 404 response message for an existing resource?

I'm new to implementing web services and I'm doing it with jax-rs API using eclipse IDE for java-ee developers 2022. I have written a simple web service that re

CodeFights - issues with time limit when writing FirstDuplicate method

I'm trying to solve the problem below from CodeFights. I left my answer in Java after the question. The code works for all the problems, except the last one. Ti

java.lang.AbstractMethodError: com.mysql.jdbc.Connection.isValid(I)Z

I am trying to connect my Servlet to mysql database using data Source . But whenever I run my servlet I end up getting this exception : java.lang.AbstractMetho

HashMap and int as key

I am trying to build a HashMap which will have integer as keys and objects as values. My syntax is: HashMap<int, myObject> myMap = new HashMap<int, m

spring-boot ReactiveClientRegistrationRepository not found

Environment: Spring Boot 2.3.1, Java 11 I have tried out a few things already (also comparing with the sample-app by spring), but so far I have been unsuccessfu

Javamail Could not convert socket to TLS GMail

I'm trying to send an email using JavaMail through Gmail SMTP Server. This is the code: final String username = "[email protected]"; final String password = "my

How do I print a double value without scientific notation using Java?

I want to print a double value in Java without exponential form. double dexp = 12345678; System.out.println("dexp: "+dexp); It shows this E notation: 1.23456

How to find the tag Value in the dynamic JSON-Object with Java 8

I have JSON-object which has a dynamic key inside it. I need to get a specific value mapped to this dynamic Key. For example: value "10.00" will be returned for

Is there a way to make a 2nd click change the result?

I'm trying to make it when you click the cameraButton, the graphics show, but when clicked again, it closes. @Override public void paintComponent(Graphics g

What is the "proper" way to cast Hibernate Query.list() to List<Type>?

I'm a newbie with Hibernate, and I'm writing a simple method to return a list of objects matching a specific filter. List<Foo> seemed a natural return typ

Is it OK to add default implementations to methods of an interface which represents a listener?

There is a certain library I use in my project. This library has an interface which has about 15 methods. The purpose of this interface is to make it possible

Unable to Verify that GCS bucket and PKIX path building failed Errors in Creating and staging GCP Dataflow template

I am creating and staging gcp dataflow template in cloud storage with following command: mvn -X compile exec:java -Dexec.mainClass=main.java.TemplatePipeline -D