Skip to content
Advertisement

Tag: spring

Spring JPA relationships

I have some troubles with Spring JPA relationships. I have two entities: Gift and Candy. And I want user to be able to select available candy and add it to gift. How can I do that using spring jpa? I’ve already tried ‘one to many’ relationship with gift as owning side, and I got “null value in column ‘gift_id violates

Variables are not coming up null during Postman call

Setting up an Java Postman call assigning values to the variables but its shows null. My Pojo Student Class Postman Request Answer your request body should be like this: because you are getting StudentRequest as RequestBody and it means you should send StudentRequest internal properties not containing StudentRequest it self in request , second problem is that your RequestBody contains

Error running a Java 8 batch with a jdk17

I’m trying to run a java 8 batch with a jdk17, the project is built with a jre1.8.0_192 and I put the following options in the VM: –add-modules=ALL-SYSTEM –add-opens=java.base/java.lang=ALL-UNNAMED –add-opens=java.base/java.math=ALL-UNNAMED –add-opens=java.base/java.net=ALL-UNNAMED –add-opens=java.base/java.util=ALL-UNNAMED –add-opens=jdk.attach/sun.tools.attach=ALL-UNNAMED -Djava.locale.providers=JRE,SPI I get the following error at runtime: java.lang.NullPointerException: Cannot invoke “Object.getClass()” because “obj” is null at java.lang.reflect.Method.invoke(Method.java:561) ~[?:?] at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333) ~[spring-aop-4.3.25.RELEASE.jar:4.3.25.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) ~[spring-aop-4.3.25.RELEASE.jar:4.3.25.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)

How to handle Docker-Secrets in application.properties files

How do you inject Docker secrets (files/data from /run/secrets) into the application.properties files? Is it safe to use environment variables? Answer First of all, usage of environment variables for secret data for the application.properties isn’t safe. You have mainly two options when talking about Secrets. If you are using Docker Secrets without Docker Swarm then you can directly load the

Use another MapStruct mapper only inside an expression clause

I have a mapper that, for a particular attribute of the target class, needs to choose one from a list of objects inside the source object, and map it using a differente mapper class. Simplifying it a lot, the Game class contains a list of Transaction objects, and my GameMapper class looks like this: The thing is, EventMapper gets generated

Can I extend MapStruct methods?

I’m developing a library and I expect the library to have a mapper like so: Which is meant for internal remapping. Now, I’d like to add a feature where the user can “override” this method, in the sense that they could for example add a statement to ignore the password of the account, while also calling the internal methods. Few

Advertisement