How to export a Spring Boot project to an executable standalone file?

Java
I have created a project in Spring Tool Suite with Spring Boot and Gradle, and I really don't know how to export to make it work. I don't know much a...
3 years ago

How do I inject a logger into a field in the sample spring boot application?

Java
What I want is to make spring autowire a logger. So, in other words, I want to have this working: import javax.servlet.http.HttpServletResponse; imp...
3 years ago

Java: Getting a unique hash value of an object

Java
I am trying to get a unique hash value for a Java object, such as the following are true: If A == B then A.HashValue() == B.Hash.HashValue() If A !=...
3 years ago

java.lang.NumberFormatException: Invalid int: "" : Error

Java
I am doing some calculation but unable to parse a string into int or even in float.I searched for solution and i read it somewhere there must be a emp...
3 years ago

Is there a performance difference between a for loop and a for-each loop?

Java
What, if any, is the performance difference between the following two loops? for(Object o: objectArrayList){ o.DoSomthing(); } and for(int i=...
3 years ago

java library to find the mime type from file content

Java
I am searching for a java library which tells you the mime type by looking at the file content(byte array). I found this project using jmimemagic and ...
3 years ago

Cannot load parameters in Struts 2 action

Java
In reference to Struts 2 and business objects and the code stated there: I cannot load the rp.randomCode as it gives it null. I have getters/setters...
3 years ago

Spring Security 3.2.7: How to access user details by Thymeleaf

Java
I'm using: Spring Security version 3.2.7 Spring version 4.0.0 Thymeleaf version 2.1.2 I want to access user details from the xhtml page like: f...
3 years ago

Update query for java servlet +mysql database

Java
I'm trying to run update query on table doctors. The primary key of the table is defined as a composite primary key (deptid, docid). What I'm trying t...
3 years ago

Java 8 - Best way to transform a list: map or foreach?

Java
I have a first list : myListToParse where i want to filter the elements and apply a method on each elements and add the result in another list : myFin...
3 years ago

Different methods to open a website

Java
I want to implement a button in my app which leads to a website. I found these two easy ways to solve it and I wonder if there is actually a functiona...
3 years ago

Regex to match a consecutive occurrence of two backslashes?

Java
I have to replace all occurrences of '\''\' with '\' in a String. I know regex "\\\\" means \ but how do I write a regex for replaceAll() to match '\'...
3 years ago

HTTP Status 405 - Request method 'POST' not supported Spring Security Java Config

Java
Hello I am facing the 'HTTP Status 405 - Request method 'POST' not supported' exception when trying to do login using spring security. Following is m...
3 years ago

Passing parameters in URL without query string in Struts 2

Java
I Like to use URLs like host/ActionName/123/abc/, instead of passing query string like host/ActionName?parm1=123&parm2=abc. How can I do that in...
3 years ago

how to check if number is octal and contains up to 6 digits in java

Java
How to check if number is octal and contains up to 6 digits in java? I was told this.. can anyone explain this piece by piece? ^0[1-7][0-7]*$ ...
3 years ago

How to check if a service is already running or not in android?

Java
In my project I am starting a service when a button is clicked. But I don't want to start that service again when that button is clicked unless the pr...
3 years ago

Java Spring will not talk to Consul when run as a Docker container

Java
I am trying to solve what I believe is a common use case for running micro services. In this case I am testing consul with a spring cloud application...
3 years ago

How to use Java 8 streams to find all values preceding a larger value?

Java
Use Case Through some coding Katas posted at work, I stumbled on this problem that I'm not sure how to solve. Using Java 8 Streams, given a list ...
3 years ago

Complex if/else logic in java with multiple variables

Java
There can be two types of groups- private and public. Each group can have members in it. I have three parameters id, includePrivate, includePublic to ...
3 years ago

How to unit test side effecting logic

Java
I have a following code public class Component extend Framework { private Integer someInt; private String someString; public Integer getS...
3 years ago