I’m trying to use spring boot starter and spring boot starter web. So far I’ve got what I think is a pretty simple set up. I can see that the application is obviously finding and using the log4j2-spring.xml file so my question is why doesn’t anything from the MyRunner class log via log4j2? I…
Swagger/OpenAPI annotations V3 – use Enum values in swagger annotations
I’m creating the the API description of our application using Swagger/OpenApi V3 annotations, imported from following dependency: One of the annotations is a @Schema annotation that accepts an attribute named allowableValues which allows a an array of strings: Now I would like to use a custom method con…
Sonar “Make transient or serializable” error
I have the following serializable class (implements serializable): However , it seems like this property is causing some problems with serialization : How can I solve this problem ? Also , is there any downside in not making this transient or serializable ? Will I be able to serialize this class fully ? Answe…
Capture setters inside mapper method using AspectJ in Spring
I have java classes like this : I have a mapper method with annotation like this : My FieldPermissionAspect fetches the permission-field mapping from db for a user and sets field to null if user does not have permission for given field. I get a list of string field hierarchy like this : I want to set b, c, d
How to use Criteria in JPA in Spring boot?
I am using JPA and spring boot. I am new to JPA. I want to retrieve an object by passing the value of the function. But in example, it is done through hibernate config. I have not config sessionFactory bean in my classpath. I want to use JPA to retrieve the object. Here in the example, it is: But I
What are transient dependencies?
I am studying the bnd introduction, and it says: ‘The advantage of Java was that it had found an elegant solution to the scourge of transient dependencies: Java interfaces.’ I also found the following quote: in the book ‘Professional Java for Web Applications’, but is there a simpler e…
SpringBoot 2.2.1 groovyMarkupConfigurer exception
I have a SpringBoot application that was developed with JDK8 and was now ported to JDK11. I get the following exception at startup: Here is my pom.xml: I have tried SpringWebStarter from 2.1.8 up to 2.2.1, I am always getting the same error. I cannot use JDK8 again, since the computer has been updated from Wi…
Use application.properties in a non-spring injected class
I have a class which is created with new B(this); in this class B I want to use a value from the application.properties. But because (as far as I understand) because it’s not created with Spring it won’t have any injection (I use the @Value annotation) That is how the class is created: The class i…
how to decode Java stream in PHP
I requested Walmart report API and the result would be returned zip file stream.Refer to the API documents,it gives an example to realize it with Java code as the following below: However,if I use php like: It would download zip file but the file data is corrupt.It maybe such a reason like the byte stream is …
Jmeter NullPointerException when running the GUI
I have installed Jmeter using brew install Jmeter when I run jmeter from command line i get this error: I checked the jmeter.log file and this is what I get: Java version: anyone was able to fix this? Answer Can it be the case you’re using DisplayLink? If so, most probably you’re suffering from Ja…