Thread
#feed
    sdeleuze

    sdeleuze

    2 years ago
    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
    Tristan

    Tristan

    2 years ago
    I miss your messages so much, you always have good news 😄
    sdeleuze

    sdeleuze

    2 years ago
    🙂
    nfrankel

    nfrankel

    2 years ago
    will read later thanks!
    todd.ginsberg

    todd.ginsberg

    2 years ago
    Very exciting!
    sdeleuze

    sdeleuze

    2 years ago
    Thanks 🙂
    Robert Jaros

    Robert Jaros

    2 years ago
    Does Spring Fu target Spring MVC or Spring WebFlux? Does it support Kotlin coroutines?
    nfrankel

    nfrankel

    2 years ago
    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?
    sdeleuze

    sdeleuze

    2 years ago
    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 »
    nfrankel

    nfrankel

    2 years ago
    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
    ?
    sdeleuze

    sdeleuze

    2 years ago
    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 😉
    nfrankel

    nfrankel

    2 years ago
    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
    Robert Jaros

    Robert Jaros

    2 years ago
    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?
    Tristan

    Tristan

    2 years ago
    Also, I read a tweet where you talked about some FE stuff, is that related? 🤤
    sdeleuze

    sdeleuze

    2 years ago
    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?
    Robert Jaros

    Robert Jaros

    2 years ago
    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.
    sdeleuze

    sdeleuze

    2 years ago
    I am not sure to understand, could you share a code example ?
    Or a repro project ?
    Tristan

    Tristan

    2 years ago
    Yes @sdeleuze
    Robert Jaros

    Robert Jaros

    2 years ago
    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:
    @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:
    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
    sdeleuze

    sdeleuze

    2 years ago
    @Tristan Yeah I am working on that, more news in the coming weeks
    @Robert Jaros Thanks I will have a look