Closed hdeadman closed 2 years ago
Please share a minimal repro project where we can see the error on JVM + AOT.
In looking closer at the stacktrace I noticed it was likely due to the spring cloud BootstrapApplicationListener class which seems to re-run the SpringApplication. I re-purposed an old reproducer, and the error happens if the
implementation 'org.springframework.cloud:spring-cloud-starter-bootstrap'
dependency is added.
https://github.com/hdeadman/spring-native-reproducer
You can run ./test-maven.sh --server.port=8080
or ./test-gradle.sh --server.port=8080
to see the error with JVM+AOT. If you remove the spring-cloud-starter-bootstrap
dependency from build.gradle or pom.xml then there will not be an error.
If you don't pass in server.port then you will see another error caused by the ServerProperties
config class not being available as a bean constructor parameter, the way it is in most spring boot applications (but that is an unrelated issue and the bean is available if you have server.port defined).
You can see the errors here: https://github.com/hdeadman/spring-native-reproducer/actions/runs/1931438614
As documented in https://docs.spring.io/spring-native/docs/current/reference/htmlsingle/#support, Spring Cloud Bootstrap is no longer supported with Spring Native 0.11+. We will work on a proper solution in Spring Boot 3 timeframe. if you really need to use it, maybe try with Spring Native 0.10.6.
Just to confirm, does "Spring Cloud Bootstrap" refer to all of the code under the org.springframework.cloud.bootstrap
package? e.g. PropertySourceLocator
etc? Not just the use of the spring-cloud-starter-bootstrap
dependency? Is the alternative to use the spring.config.import
property?
@OlgaMaciaszek Could you please provide a feedback to @hdeadman ?
Sure, @sdeleuze; @hdeadman, yes, only the Spring Boot Config Data Import is supported for native, so you'll need to use the spring.config.import
property. You can take a look at this native sample.
I am getting the following error where the servlet context isn't set on a bean implementing
ServletContextAware
when running in java AOT mode:https://github.com/hdeadman/cas-overlay-template/runs/5342311945?check_suite_focus=true#step:8:5368
Could that be due to eager initialization of beans so that might result from these messages?
Some of those transaction related beans are internal to the CAS application but
integrationChannelResolver
is coming from spring integration.The javadocs for
TransactionManagementConfigurer
say:Is using
TransactionManagementConfigurer
incompatible with spring native?