Hello I have some problem with the <https://docs.s...
# spring
m
Hello I have some problem with the https://docs.spring.io/spring-hateoas/docs/1.1.0.RELEASE/reference/html/#server.affordances implementation in Kotlin. have maybe somebody this done already ?
k
not really but you should describe your problem
👍 1
m
makes sense. will update it. my questions 🙈
I was trying to Kotlinies the following

https://youtu.be/nVEmfmdDUXU

k
but we still don't know what is your issue?
what's the error?
m
i will post it later. AFK at the moment
Copy code
: Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.aop.framework.AopConfigException: Unexpected AOP exception; nested exception is java.lang.NullPointerException] with root cause

java.lang.NullPointerException: null
	at org.springframework.aop.framework.CglibAopProxy.doValidateClass(CglibAopProxy.java:257) ~[spring-aop-5.3.3.jar:5.3.3]
	at org.springframework.aop.framework.CglibAopProxy.doValidateClass(CglibAopProxy.java:280) ~[spring-aop-5.3.3.jar:5.3.3]
	at org.springframework.aop.framework.CglibAopProxy.validateClassIfNecessary(CglibAopProxy.java:243) ~[spring-aop-5.3.3.jar:5.3.3]
Is there maybe maven plugin missing….
k
try add dependency on
Copy code
<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-web</artifactId>
		</dependency>
m
Thanks .. same issues. still
k
and without hateoas it works as expected?
m
also with
HATEOAS
I only have a problem when I try with the
Affordance
links.andAffordance(afford<Any> {  })
I am not sure maybe my (the issue) is about the null checks….. when I add the
GET
function (method) I don’t get any exception
but I also try to add a (in the sample)
customer object
or I miss something in the
POST
but I don’t get it…
image.png
now I try it from the Spring manual …
<https://docs.spring.io/spring-hateoas/docs/1.1.0.RELEASE/reference/html/#server.affordances.api>
I think I get it now 🙂
I change the
POST
with a
return
value.
🙂 maybe I was too fast 😞
k
👍
m
I think I use the
KotlinDSL
wrong ..
Copy code
val create: Affordance = afford<Any> {
            methodOn(CustomerController::class.java).add(customer = Customer(firstName = "", lastName = ""))
        }
with the following code I get again exception
The Type have to be like
afford<CustomerController>
Copy code
val create: Affordance = afford<CustomerController> {
            methodOn(CustomerController::class.java).add(customer = Customer(firstName = "", lastName = ""))
        }
Thanks for the support… 🙂