https://kotlinlang.org logo
#spring
Title
# spring
l

Luca Piccinelli

04/15/2021, 7:27 AM
Good morning. Does anyone know which version of spring introduced the beans and routing kotlin DSLs ? https://docs.spring.io/spring-framework/docs/current/reference/html/languages.html#kotlin-web
n

nfrankel

04/15/2021, 7:41 AM
i think it was 5.0 ping @sdeleuze for confirmation
actually, not necessary the javadoc confirms:
Copy code
* @author Sebastien Deleuze
 * @see BeanDefinitionDsl
 * @since 5.0
s

sdeleuze

04/15/2021, 7:43 AM
Yep indeed
n

nfrankel

04/15/2021, 7:43 AM
sorry seb 😅
s

sdeleuze

04/15/2021, 7:43 AM
Np
l

Luca Piccinelli

04/15/2021, 8:58 AM
Thank you! I didn't find it 🙂
I'm writing an article about it, with some benchmarking compared to standard annotations
👍 1
t

thanksforallthefish

04/16/2021, 7:04 AM
do you care only about performances? a while back I looked into functional routing for webmvc but there were some missing features, I think spring hateoas was not working (ofc I might be wrong, memory might not serve me right). or it was automatic swagger generation with springdoc (third party library). I guess what I wanted to say is, you might want to investigate also functional limitations compared to annotations approach
s

sdeleuze

04/16/2021, 7:07 AM
See https://springdoc.org/#spring-webfluxwebmvc-fn-with-functional-endpoints for OpenAPI, that would be interesting to have a Kotlin sample of that in the blog post.
The project lead is pretty reactive if you need more info for the Kotlin version you can maybe ask on https://github.com/springdoc/springdoc-openapi/issues to add a Kotlin sample in their doc.
Even if quiet for now as most of my time is on Spring Native, check https://github.com/spring-projects-experimental/spring-fu to see the functional vision fully leveraged.
From my POV the programming style is more imprtant than performances. Performances mainly comes from the explicit nature. Unlike what more people think, reflection and classpath scanning done right are fast on the JVM.
But yeah in the end performances are usually better with Spring Fu style apps.
l

Luca Piccinelli

04/16/2021, 7:18 AM
yes, I also prefer the DSL for the style... not for performance
Indeed the benchmark doesn't bring any evidence of better performance if no CGLIB is in place
s

sdeleuze

04/16/2021, 7:19 AM
Yeah Spring Framework and Spring Boot are well optimized. Usually what make Spring Fu faster is that you enable less infra.
l

Luca Piccinelli

04/16/2021, 7:19 AM
if I understood it well, the DSL should enforce a coding style that let's you avoid CGLIB completely
s

sdeleuze

04/16/2021, 7:22 AM
CGLIB proxies are already disabled on regular Spring Boot configs via the
proxyBeanMethods = false
attribute. Only used for proxies on classes for transaction, security, etc. Spring AOT incubated in Spring Native (https://docs.spring.io/spring-native/docs/current/reference/htmlsingle/#spring-aot) will allow shortly to create proxies at build time.
l

Luca Piccinelli

04/16/2021, 7:22 AM
The main doubt that I have is about how well it integrates with spring security. And also if in this case it is possible to avoid CGLIB proxies
s

sdeleuze

04/16/2021, 7:23 AM
Yeah integration is not fully done for advanced features like Security. This is what we intend to incubate in Spring Fu.
👍 1
l

Luca Piccinelli

04/16/2021, 3:03 PM
4 Views