Comments (6)
Thanks for the report.
There's quite a lot going on in the demo application. There are many classes that I don't think are related to the problem. Kotlin is also involved which makes things quite a bit more complicated, particularly when using GraalVM. Can you please reduce the classes involved to the bare minimum required to reproduce the problem and, unless the problem only occurs with Kotlin, please write those classes in Java.
from spring-framework.
I minified the example in the repository. Please check again. I now identified the main problem. It is not related to kotlin. The main problem seems to be the @Lazy
in the BeanPostProcessor
. Without that @Lazy
the tests run successfully.
from spring-framework.
I also tried refactoring my code to use ObjectProvider<MqttProperties>
via class MqttSubscriberCollector(private val config: ObjectProvider<MqttProperties>) : BeanPostProcessor
but this seems to not work here, as the following error is reported: Caused by: org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'mqtt-de.smartsquare.starter.mqtt.MqttProperties': Requested bean is currently in creation: Is there an unresolvable circular reference?
Any other way I could ditch the @Lazy
as a workaround?
from spring-framework.
Thanks very much for minimising the sample.
Using ObjectProvider<MqttProperties>
seems to work for me (with your Java-based sample) so I'm not sure what's happening for you when you try it using Kotlin.
The use of @Lazy
causes MqttProperties
to be proxied. Ideally, Spring Framework's AOT support would generate the necessary reflection metadata for this automatically but that isn't happening. I also tried using a @Bean
method with a @Lazy
parameter:
@Bean
static MqttSubscriberCollector mqttSubscriverCollectior(@Lazy MqttProperties properties) {
return new MqttSubscriberCollector(properties);
}
My goal was to make the use of @Lazy
more obvious such that it would be automatically detected by Framework but it was not successful.
We'll transfer this to the Framework team so that they can investigate.
from spring-framework.
Yeah I got it working with ObjectProvider
meanwhile. Was just a stupid mistake to eagerly call the getObject()
method inside the bean post processors constructor. You were right, that seems to workaround this. Thanks for investigating 😃
from spring-framework.
Thanks for the report, I believe this is a duplicate of #30985 and we'll validate this sample when we get to it.
from spring-framework.
Related Issues (20)
- Unexpected exception in UriComponentsBuilder with a valid URI. HOT 2
- The RestClient is configured without content-length attribute in the request header by default HOT 1
- Accept ajc-compiled `@Aspect` classes for Spring AOP proxy usage HOT 1
- Accept ajc-compiled `@Aspect` classes for Spring AOP proxy usage HOT 1
- "GET must not have a request body" exception with RestTemplate.exchange(...) and OkHttp3ClientHttpRequest.executeInternal() HOT 7
- MockHttpServletRequest should not use a shared reader when no content is available HOT 1
- `@PathVariable` is used in the `@Controller` occurred java.lang.OutOfMemoryError: Java heap space HOT 4
- Add support for qualifiers in test bean overriding and consider improving by-type matching
- Socket.io support HOT 1
- Make it easier to register reflection hints on interface hierarchies
- Unexpected bean override / inject behavior
- Support Map in FormHttpMessageConverter HOT 4
- Add support for flagging an interface to declaratively expose it as an rsocket remote service
- Create WebFlux equivalent filter to handle URLs with trailing slashes
- Do not send Cookie header in reactive JdkClientHttpRequest if no cookies added HOT 1
- Introduce static `MultiValueMap` factory methods HOT 2
- https://stackoverflow.com/feeds/tag?tagnames=springspring-mvcspring-webfluxspring-aopspring-jdbcspring-r2dbcspring-transactionsspring-annotationsspring-jmsspring-elspring-testspring-java-configspring-remotingspring-ormspring-jmxspring-cachespring-rsocket&sort=newest
- Limit reflective operations in `BeanInstanceSupplier` with Spring AOT
- Unify Spring Framework documentation
- Introduce API to initialize `BeanFactory` before singleton instantiation
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spring-framework.