-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bean could not be injected #220
Comments
I tried to debug it. The values go missing in AnnotProxyFieldValueFactory, Line 164 when it is wrapped in a proxy:
As far as I understand this is done to ensure page stays serializable. But how am I supposed to inject beans that have other beans? |
Does it work without the Starter? I haven't used Kotlin yet. Can you provide an example project? |
I did not try to integrate spring without the starter because I don't really know how I would need to configure spring to work with wicket. I setup a small project: https://github.com/Evodam/wicket-spring-showcase Just run the main method in WicketApplication.kt and open localhost/8080. In console this error occurs:
|
Two Problems:
// MyService
package de.evodam.wicketspringshowcase
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Component
@Component
open class MyService {
@Autowired
lateinit var myRepository: MyRepository
// ByteBuddy needs an empty constructor
constructor(
) {
}
} // WicketApplication
package de.evodam.wicketspringshowcase
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.builder.SpringApplicationBuilder
fun main() {
SpringApplicationBuilder()
.sources(WicketApplication::class.java)
.run()
}
@SpringBootApplication
open class WicketApplication() {
} // build.gradle.kts
// add
sourceSets {
main {
java {
srcDir("src/main/kotlin")
}
// Is needed to detect the html files
resources {
srcDir("src/main/kotlin")
}
}
test {
java {
srcDir("src/main/kotlin")
}
resources {
srcDir("src/main/kotlin")
}
}
} |
@MarcGiffing |
@MarcGiffing
And this is written in console:
I fiddled a little bit around and think I found something that seems to work although it still looks very verbose and I'm not quite happy with it:
Everything is pushed to my github repo. |
This is my page:
This is the class LoginAction:
When I inject authenticator to page itself it is present. But when I inject it to the LoginAction-class is stays null. What am I doing wrong?
I also tried annotating it with @jakarta.annotation.Resource but this doesn't work either.
I am using wicket-spring-boot-starter 4.0.0.
The text was updated successfully, but these errors were encountered: