https://kotlinlang.org logo
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
spring
  • s

    Slackbot

    06/10/2022, 10:21 PM
    This message was deleted.
    a
    • 2
    • 1
  • d

    dany giguere

    06/13/2022, 9:27 PM
    Hello everyone. I spent the last few weeks learning Spring boot with Kotlin, but I’m stuck at the point where I can’t figure out how to implement the spring security jwt
    stateless
    authentication. The front end will be an SPA.
    Anyone knows an easy tutorial that could help me ?
    I’ve tried many ones but it was too complicated for a spring boot rookie like me.
    :not-kotlin: 2
    t
    • 2
    • 1
  • j

    João Gabriel Zó

    06/16/2022, 4:57 PM
    I have 4 different endpoints in my Controller that all have the same 7 headers. Is there a way to avoid boilerplate code, i.e. repeating each header declaration for every endpoint?
    :not-kotlin: 2
    r
    • 2
    • 1
  • v

    Václav Škorpil

    06/21/2022, 12:01 PM
    Hi I have a problem with serialization enum using kotlin, spring, jackson. I made a stack overflow question so i wont copy paste it, maybe someone of you will know how to solve it. https://stackoverflow.com/questions/72700370/spring-boot-serialize-kotlin-enum-by-custom-property.
    👀 1
    j
    p
    • 3
    • 6
  • s

    sreich

    06/21/2022, 8:30 PM
    are there recommendations for moving from Java to Kotlin for hibernate? in particular, i'm trying to get the best null safety i can get... There is this https://medium.com/swlh/defining-jpa-hibernate-entities-in-kotlin-1ff8ee470805 but...my issue is, if i set nullable=false...that should be a @nonnull object, because i know it's an impossibility for it to happen in my scenarios. How can I get that though? do I need to use lateinit here?
    m
    s
    t
    • 4
    • 11
  • s

    sreich

    06/22/2022, 5:22 PM
    I'm getting the following when trying to use JPA, spring, noargs, all-open.
    Class 'CmcSbsbSubsc' should have [public, protected] no-arg constructor
    this doesn't seem to be a compiler issue though...it compiles fine through maven. Does this mean this intention is wrong because we are doing noarg at annotation time? and i should tell IDEA to ignore that warning on the class name?
    @Entity
    @Table(name = "CMC_SBSB_SUBSC", schema = "FACETCOR")
    data class CmcSbsbSubsc(
        @Id
        @Column(name = "SBSB_CK", nullable = false)
        val sbsbCk: Long,
    
        @Column(name = "SBSB_ID", nullable = false)
        val sbsbId: String
    )
    m
    a
    a
    • 4
    • 10
  • s

    sreich

    06/28/2022, 6:13 PM
    i'm running into an issue with JPA/hibernate and the spring jpa plugin, which is supposed to generate no-arg ctors for each class. It does...BUT, it does not do so for composite key classes. for example. I understand why this is..because no-args is looking for particular annotations. but what annotation can I mark here, to not conflict with anything in hibernate, but get no-args to see it? Short of making my own annotation EDIT: i think i need
    @Embeddable
    to get it to work. hopefully that doesn't interfere
    @EqualsAndHashCode
    class CmcMepePrcsEligId(
    val memeCk: Long,
    val cspdCat: String
    ) : Serializable {
    companion object {
    private const val serialVersionUID = 1L
    }
    }
  • s

    sreich

    06/28/2022, 6:33 PM
    huh. nope. I just ran into this issue: https://youtrack.jetbrains.com/issue/IDEA-240844
  • s

    sdeleuze

    07/01/2022, 1:08 PM
    https://twitter.com/sdeleuze/status/1542857535740329984
    🎉 5
    :thank-you: 5
    🙌🏼 1
    🙌 6
    :nice: 11
    :kotlin-intensifies: 1
    :kotlin-intensifies-purple: 4
    k
    f
    • 3
    • 8
  • a

    antonarhipov

    07/06/2022, 10:50 AM
    📢 hello folks! We are in process of updating the Spring-Kotlin tutorial in our documentation. I think it’s a good time to ask for the feedback from the community. We don’t plan to make it super-comprehensive though, the goal is rather to show how to get started with Kotlin in the Spring projects and cover some of the obvious use cases. Here I have the first draft. Please let me know what do you think about in the thread :thread-please:
    Create a RESTful web service with a database using Kotlin and Spring Boot.pdf
    👍 3
    m
    e
    +3
    • 6
    • 18
  • s

    sreich

    07/07/2022, 3:51 PM
    regarding my other thread reply, i'm currently getting a 'smart cast is impossible because xyz is a property that has an open or custom getter'. I am using the all-open plugin. is there a workaround for this? is it just a consequence of JPA, or something else? i mean, a workaround to still get smartcasts
    s
    k
    • 3
    • 4
  • m

    mp

    07/13/2022, 12:57 PM
    hi there did anyone update SB recently? (I`m moving from 2.5 to 2.7) Receiving
    No default constructor found; nested exception is java.lang.NoSuchMethodException
    on configuration class loading(with sb 2.6 and 2.7) that have been properly loaded(with SB 2.5) with constructor injection have I missed some important about bean configuration process updates?
    m
    t
    • 3
    • 24
  • g

    George

    07/17/2022, 12:34 PM
    hi guys, i am getting
    finishConnect(..) failed: Connection refused: /[0:0:0:0:0:0:0:1]:80; nested exception is io.netty.channel.AbstractChannel$AnnotatedConnectException: finishConnect(..) failed: Connection refused: /[0:0:0:0:0:0:0:1]:80
    org.springframework.web.reactive.function.client.WebClientRequestException: finishConnect(..) failed: Connection refused: /[0:0:0:0:0:0:0:1]:80; nested exception is io.netty.channel.AbstractChannel$AnnotatedConnectException: finishConnect(..) failed: Connection refused: /[0:0:0:0:0:0:0:1]:80
    from a rather simple springboot-kotlin code. Has anyone encountered this? Thanks in advance 🙂
    c
    • 2
    • 4
  • s

    sdeleuze

    07/19/2022, 1:46 PM
    https://twitter.com/sdeleuze/status/1549390174454415361
    🎉 9
    :kotlin-intensifies-purple: 1
  • k

    kubele

    07/26/2022, 8:40 PM
    Hi, is anyone with experience with
    spring-boot-starter-data-cassandra-reactive
    and
    CoroutineCrudRepository
    ? I’m quite struggling with using reading user-defined type (UDT), writing to the table works fine. Sample repo here
  • m

    Marian Schubert

    07/29/2022, 9:42 AM
    🤯 I'm having trouble with Kotlin + Spring magic (
    @Transactional
    ) in following code:
    class MyBoolean(var value: Boolean) {
        fun get(): Boolean = value
    }
    
    abstract class Foo {
        private val _hasError = MyBoolean(false)                                // <- line 16
        val hasError: Boolean get() = _hasError.get()
    }
    
    @Component
    class MyFoo : Foo() {
        @Transactional
        fun doFoo() {
        }
    }
    
    class FooTest : SpringTest() {
        @Autowired
        lateinit var foo: MyFoo
    
        @Test
        fun `is null`() {
            assertThat(foo.hasError).isFalse                                    // <- line 33
            foo.doFoo()
        }
    }
    code/test above throws exception
    java.lang.NullPointerException: Cannot invoke "com.bitsafe.behi.admin.projections.MyBoolean.get()" because "this._hasError" is null
    
    at Foo.getHasError(FooTest.kt:16)
    at <http://FooTest.is|FooTest.is> null(FooTest.kt:33)
    which doesn't make sense as
    _hasError
    should never be
    null
    ? If I remove
    @Transactional
    from
    doFoo
    method everything works as expected. What's going on? BTW problem also disappears if I put stuff from
    abstract class Foo
    directly into
    class MyFoo
    (which I don't want).
    c
    s
    • 3
    • 10
  • s

    Siddhartha Juluru

    08/13/2022, 2:23 AM
    Does anyone know if it's possible to use JSR-380 validation without being required to have all my class constructor parameters be nullable? Meaning can I do this
    @Entity
    class Test(@field:NonNull val param: String)
    or do I have to do
    @Entity
    class Test(@field:NonNull val param: String?)
    m
    j
    t
    • 4
    • 13
  • m

    Mikhail

    08/18/2022, 1:14 PM
    Hello everybody! I am new in spring boot. I would like to know if you have some tools to generate openapi json documentation during the build of spring boot project? I would like to integrate autogeneration of the json file in github action ci. Thank you
    s
    • 2
    • 6
  • a

    Arjan van Wieringen

    08/19/2022, 8:06 AM
    Hello, I am a big fan of Spring, but an even bigger fan of Kotlin Multiplatform, especially the common code part. However, for entities and persistence this is not possible, since the annotations are JVM-world only. What would be an optimal way to share the entities between platforms? One way would be to just accept it and write
    fromDataEntity
    and
    toDataEntity
    helper functions for every common data class which is to be persisted. But that is a lot of boilerplate I suppose. Any other ideas?
    r
    • 2
    • 5
  • a

    Arjan van Wieringen

    08/19/2022, 9:51 AM
    Another question. Does
    RepositoryRestResource
    not work with
    UUID
    ? I am getting "EntityRepresentationModel not found!": I have a very simple Entity and Repository:
    @Entity()
    class Account(
        @Id var id: UUID,
        var name: String
    )
    
    @RepositoryRestResource(path="accounts", collectionResourceRel = "accounts")
    interface AccountRepository : CrudRepository<Account, UUID> {
    }
    
    @Bean
    fun initializeDatabase(accountRepository: AccountRepository) = ApplicationRunner {
        accountRepository.save(Account(id = UUID.randomUUID(), name = "Test"))
        <http://logger.info|logger.info>("Initialized test data")
    }
    And when I run the application I get a nice HATEOS response:
    {
      "_embedded": {
        "accounts": [
          {
            "name": "Test",
            "_links": {
              "self": {
                "href": "<http://localhost:8080/accounts/4c12f420-6189-4abd-a970-573ba2e0ca23>"
              },
              "account": {
                "href": "<http://localhost:8080/accounts/4c12f420-6189-4abd-a970-573ba2e0ca23>"
              }
            }
          }
        ]
      },
      "_links": {
        "self": {
          "href": "<http://localhost:8080/accounts>"
        },
        "profile": {
          "href": "<http://localhost:8080/profile/accounts>"
        }
      }
    }
    But when I go to that URL I get a 404 and an error in the console saying:
    Resolved [org.springframework.data.rest.webmvc.ResourceNotFoundException: EntityRepresentationModel not found!]
    It works with a Long as ID. So that is confusing. EDIT: I need to add
    @Column(columnDefinition = "BINARY(16)")
    to the entity ID.
  • l

    Leonardo Borges

    08/25/2022, 9:20 AM
    Hello! Has anyone achieve to made the
    @Transactional
    work using
    suspend
    functions? (using sql db)
    r
    w
    • 3
    • 2
  • d

    Davio

    08/26/2022, 6:56 AM
    Hi all, I noticed that by default, the Spring annotation @ConfigurationProperties is not added to the list of all-open annotations (which I think is here: https://github.com/JetBrains/kotlin/blob/cca2680c7f1c3e690a9f4a56f13449f20ebfaa6d/plugins/allopen/allopen-cli/src/AllOpenPlugin.kt), would it be useful to add it? We've had some issues with it and adding it manually to our all-open had solved it:
    <option>all-open:annotation=org.springframework.boot.context.properties.ConfigurationProperties</option>
    k
    e
    • 3
    • 10
  • s

    Slackbot

    08/27/2022, 3:05 PM
    This message was deleted.
    o
    w
    • 3
    • 2
  • g

    George

    08/30/2022, 12:53 PM
    Hi folks, does anyone knows if i can acces in spring-rsocket @connectMapping the setupPayload ? I get the error:
    Payload content is missing
    if try to add @Payload annotation with @connectMapping. Per my understading from docs: quote connectMapping this should work (i guess) (Snippet in thread). Thanks for any answers ins advance !
    • 1
    • 1
  • t

    Thomas Dziedzic

    09/11/2022, 1:48 PM
    I'm coming from the rails world and have been reading up on spring, is there a background job runner library I can use along the lines of ActiveJob & (sidekiq | goodjob) in spring? I have looked at spring batch but I'm not seeing a background job executor process. I did find jobrunr though, so I'm curious what others are using to run background jobs?
    t
    r
    p
    • 4
    • 9
  • d

    dany giguere

    09/12/2022, 12:07 PM
    I’m learning spring boot with Kotlin and I’m trying to do a WebClient call with Flux. I have these methods in a controller:
    @GetMapping("/slow-service-users")
        fun getAllUsers(): List<User?>? {
            Thread.sleep(2000L) // delay
            return userRepository.findAll()
        }
    
        @GetMapping(value = ["/users-non-blocking"])
        fun getUsersNonBlocking(): Flux<User?>? {
            <http://logger.info|logger.info>("Starting NON-BLOCKING Controller!")
            val userFlux: Flux<User?> = WebClient.create()
                .get()
                .uri("<http://localhost:8080/slow-service-users>")
                .retrieve()
                .bodyToFlux(User::class.java)
            userFlux.subscribe { user -> <http://logger.info|logger.info>(user.toString()) }
            <http://logger.info|logger.info>("Exiting NON-BLOCKING Controller!")
            return userFlux
        }
    /slow-service-users
    returns a proper response. But when I call
    /users-non-blocking
    , I get this error:
    "org.springframework.web.reactive.function.client.WebClientResponseException: 200 OK from GET <http://localhost:8080/slow-service-users>; nested exception is org.springframework.web.reactive.function.UnsupportedMediaTypeException: Content type 'application/json' not supported for bodyType=com.example.app.models.User
    How can I fix this
    Content type 'application/json' not supported for bodyType
    error ? The project repo is here: https://github.com/danygiguere/springboot-kotlin-example. The user model is:
    @Entity
    class User {
        @Id
        @GeneratedValue(strategy = GenerationType.AUTO)
        var id: Long? = null
    
        var username = ""
    
        @Column(unique = true)
        var email = ""
    
        var password = ""
            @JsonIgnore
            get() = field
            set(value) {
                val passwordEncoder = BCryptPasswordEncoder()
                field = passwordEncoder.encode(value)
            }
    
        fun comparePassword(password: String): Boolean {
            return BCryptPasswordEncoder().matches(password, this.password)
        }
    
        val firstName: String = ""
    
        val lastName: String = ""
    
        @JsonManagedReference
        @OneToMany(cascade = [(CascadeType.ALL)], orphanRemoval = true, fetch = FetchType.EAGER)
        @JoinColumn(name = "userId", referencedColumnName = "id")
        var posts: List<Post>? = null
    }
    g
    k
    • 3
    • 12
  • d

    dany giguere

    09/16/2022, 8:47 PM
    Hello everyone. I’m trying to implement Kotlin coroutines within a project as per this article https://spring.io/blog/2019/04/12/going-reactive-with-spring-coroutines-and-kotlin-flow. However wherever I see client.execute() or client.select(), IntelliJ highlight execute in red. All I can see when I hover is this message Unresolved reference: execute. I think I have a missing gradle package. I have these regarding couroutines:
    mplementation("org.springframework.boot:spring-boot-starter-webflux:2.7.3")
    	implementation("org.springframework.boot:spring-boot-starter-data-r2dbc")
    	implementation("org.springframework.data:spring-data-r2dbc:1.5.2")
    	implementation("io.r2dbc:r2dbc-spi:1.0.0.M6")
    	implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core")
    	implementation("org.jetbrains.kotlinx:kotlinx-coroutines-reactor")
    Anyone can see what I’m missing ?
    r
    • 2
    • 1
  • d

    dany giguere

    09/21/2022, 6:53 PM
    Using Spring and Java I’m doing a restTemplate call:
    restTemplate.exchange(uri, <http://HttpMethod.POST|HttpMethod.POST>, request, Response.class);
    the problem is that the response is an array that contains an object. How could I make the Response class to return an array ? I tried doing:
    restTemplate.exchange(uri, <http://HttpMethod.POST|HttpMethod.POST>, request, ArrayList<Response>.class);
    (then I would not need to return the class as an array) But I can only do
    ArrayList.class
    . It won’t take the
    <>
    t
    n
    • 3
    • 4
  • s

    sreich

    09/21/2022, 8:23 PM
    can i use
    jakarta.annotation-api
    .Generated on a low jdk version? (8) ?
  • m

    Michael Böiers

    09/23/2022, 2:05 PM
    Today I discovered that in Kotlin Spring (JVM) when I define a
    @Service
    with a method that declares default parameter values and then call the service from another
    @Component
    not supplying a value, there is a NoSuchMethodError thrown. Apparently Spring creates a (Java) proxy for the service which does not support default parameter values (not supported in Java). Is there a solution for this problem?
    r
    b
    +3
    • 6
    • 16
Powered by Linen
Title
m

Michael Böiers

09/23/2022, 2:05 PM
Today I discovered that in Kotlin Spring (JVM) when I define a
@Service
with a method that declares default parameter values and then call the service from another
@Component
not supplying a value, there is a NoSuchMethodError thrown. Apparently Spring creates a (Java) proxy for the service which does not support default parameter values (not supported in Java). Is there a solution for this problem?
r

Robert Jaros

09/23/2022, 2:43 PM
Spring doesn't always create proxies. I'm using
@Service
annotated components with methods with default parameters without problems.
There are likely specific cases when proxies are used, unfortunately I don't know what they are.
m

Michael Böiers

09/23/2022, 2:50 PM
Usually AOP triggers the use of Proxies. I don‘t need them, but the annoying point is that the code compiles and then fails at runtime …
b

Ben

09/23/2022, 2:52 PM
code compiles and then fails at runtime
That is the major downside of using a framework like spring where it builds the dependency graph at runtime.
m

Michael Böiers

09/23/2022, 3:53 PM
It‘s not so much a dependency problem, it’s the implicit code generation that is enabled elsewhere (not in the code it affects).
t

Thomas

09/26/2022, 8:42 AM
Transactional annotation is creating proxies I guess
w

wakingrufus

09/28/2022, 4:07 AM
I assume if you use functional bean declaration, it won't create proxies, but then you can't use any AOP annotations either
c

corneil

09/29/2022, 5:02 PM
One way to overcome this is to create a Configuration annoted class with Bean annotated method to create the service yourself.
w

wakingrufus

09/29/2022, 5:08 PM
Oh I didn't realize that prevents the proxy
m

Michael Böiers

09/29/2022, 5:29 PM
@corneil sure, there are workarounds - but it kind of spoils the experience. For my project the decision will be to move away from Spring. I’ve always wanted to try Ktor 😎
c

corneil

09/29/2022, 5:33 PM
If you want the bean to support the transactions like with the Transactional annotation you can use TransactionProxyFactoryBean
m

Michael Böiers

09/29/2022, 5:34 PM
I don’t need or want any transaction. The problem is that Spring proxies the service anyway, even though it does not have any aop-requiring annotations.
c

corneil

09/29/2022, 5:36 PM
With Configuration classes and bean methods you skip the proxies
w

wakingrufus

09/29/2022, 5:39 PM
the proxies are there for all the automagical building of the dependency graph with component scans. i prefer to avoid all that by using the functional bean declarations in spring boot 2.x (which can be extended even further such as in the spring-fu project, which create a very ktor-like API for spring boot)
m

Michael Böiers

09/29/2022, 6:06 PM
I’d rather not use Spring altogether in my project. I just did because I was used to, I think Ktor would be a better fit.
But I’ll check out spring-fu, thanks for the tip 🙂
View count: 28