Posts by Erick Maia • 119 points
9 posts
-
1
votes1
answer116
viewsA: How to access prop.getProperty from any Project Class
You can do it two ways: 1st Way - Static Leave your way static public static Properties getProp() throws IOException use it anywhere in the application this way Messages.getProp(); Disadvantage:…
javaanswered Erick Maia 119 -
0
votes4
answers6374
viewsA: Encrypt Java password with Hash sha256
See if that’s what you need... public static String encriptPassword(String password) throws NoSuchAlgorithmException { MessageDigest messageDigest = MessageDigest.getInstance("SHA-256");…
-
1
votes1
answer509
viewsA: Method that returns Java date/time
I don’t know if I got it right but... public class ClasseUtilitaria { public static String horaAtualizada() { return new SimpleDateFormat("dd/MM/yyyy HH:mm:ss").format(new Date()); } } public static…
javaanswered Erick Maia 119 -
0
votes1
answer392
viewsA: Problems with springboot filling
You should map your package with controllers. @ComponentScan({"br.com.springboot.controller"}) public class SpringBootApplication { // ... }
spring-bootanswered Erick Maia 119 -
1
votes2
answers871
viewsA: "java.lang.Nullpointerexception" error in Java
Aluno aluno = new Aluno (); //Falta setar as notas do aluno aluno.setAvalicao(...) Avaliacao poo1 = aluno.getAvaliacao();
-
1
votes1
answer4842
viewsA: Convert from String to Json in Java EE
You can use a library that parses for you like Jackson dataBind or GSON. Examples Using Jackson Examples Uitlizando GSON Basically is: ObjectMapper mapper = new ObjectMapper(); String jsonInString =…
-
2
votes2
answers976
viewsA: How to calculate the time difference?
You can use the Jodatime api http://www.joda.org/joda-time/ and do something like that: Date minhaHoraInicial = new Date(); Date minhaHoraFinal = new Date(); DateTime dt1 = new…
-
0
votes1
answer812
viewsQ: Spring Boot does not start in Debug (Java) mode
I have an application developed with Springboot and can’t start my application in mode only debug. (If not debug it starts normally) It seems to loop and this error message keeps showing up in the…
-
2
votes1
answer55
viewsA: Access to variables in another class
They’re two different objects. In the first class you have an object where you arrow the value. In second class when doing um teste = new um (); you are creating a new object in memory, you are not…
javaanswered Erick Maia 119