FYI I have released Spring Fu 0.3.0 (with KoFu Kot...
# feed
s
FYI I have released Spring Fu 0.3.0 (with KoFu Kotlin experimental DSL for Spring Boot) and shared some insights about the roadmap https://spring.io/blog/2020/05/28/spring-fu-0-3-0-and-beyond
👍 18
🎉 7
t
I miss your messages so much, you always have good news 😄
s
🙂
n
will read later thanks!
t
Very exciting!
s
Thanks 🙂
r
Does Spring Fu target Spring MVC or Spring WebFlux? Does it support Kotlin coroutines?
n
ok so as far as i understand in order to get the no-annotation experience you still need to go reactive? and it’s not going to change anytime soon did i get it right?
s
Did you read the blog post @nfrankel ?
Yes it supports both Spring MVC and WebFlux
I show an exemple in the blog post
And wrote « Since Spring MVC is now usable in a functional way »
n
it’s been the case for ages 😉 since 0.2 sorry i was not specific enough my point was about db access does it handle spring data jpa repository
?
s
Ah ok
Not yet but with the work we do currently it could be added in 0.4 Probably
Via Spring Data JDBC/JPA support
I would accept such contribution 😉
👍 1
n
i know you would 🙂 i’d love to contribute - really but i’ve come to realize i work even more now that i’m at home so i try to make long breaks away from computers and run in the countryside close to home
r
If
webMvc
and
webFlux
function were having the same name, the functional configuration would be exactly the same for both mvc and webflux? You only need to change the starter to migrate the project ;-)
Would it be possible to introduce local / child application contexts to Spring with this functional approach? Or is this out of the question because of Spring architecture?
t
Also, I read a tweet where you talked about some FE stuff, is that related? 🤤
s
If 
webMvc
 and 
webFlux
 function were having the same name, the functional configuration would be exactly the same for both mvc and webflux? You only need to change the starter to migrate the project 😉
Yeah but require much more other changes so not sure this is a goal 😉
Would it be possible to introduce local / child application contexts to Spring with this functional approach? Or is this out of the question because of Spring architecture?
It is technically possible but I am not sure to want to add this level of complexity. Most modern Spring apps don't really take advantage of app context hierarchy.
Also, I read a tweet where you talked about some FE stuff, is that related? 🤤
@Tristan FE = Front End?
r
Currently when using webflux and coroutines only the prototype and singleton scopes seems to be useful. Other scopes are based on ThreadLocal and are useless. But with the ability to create child contexts, we could autowire current
ServerRequest
. We would have request scope working again. Ktor with Guice (which supports child contexts) works in a similar way. With my KVision interfaces to Spring Webflux I'm using horrible hacks to make such simple thing working.
s
I am not sure to understand, could you share a code example ?
Or a repro project ?
t
Yes @sdeleuze
r
When Ktor is integrated with Guice, it basically creates a child guice context for every request, and binds the request (a call instance) to this context. It allows to inject current request inside other components. Here is Ktor code sample https://ktor.io/samples/feature/guice.html. But I can't do the same with Spring Webflux, because there is only one, global context. So to be able to inject ServerRequest, I'm using such workaround hack:
Copy code
@Bean
    @Scope(BeanDefinition.SCOPE_PROTOTYPE)
    open fun serverRequest(): ServerRequest {
        return threadLocalRequest.get() ?: KVServerRequest()
    }
and then I'm using it this way when getting bean from context:
Copy code
tlReq.set(req)
val service = ctx.getBean(serviceClass.java)
tlReq.remove()
You can find the whole code in KVision spring-boot module: https://github.com/rjaros/kvision/tree/master/kvision-modules/kvision-server-spring-boot/src/jvmMain/kotlin/pl/treksoft/kvision/remote
s
@Tristan Yeah I am working on that, more news in the coming weeks
👍 1
@Robert Jaros Thanks I will have a look