Skip to content
This repository was archived by the owner on Feb 23, 2023. It is now read-only.

Restore Spring Integration support #1134

Closed
sdeleuze opened this issue Oct 5, 2021 · 9 comments
Closed

Restore Spring Integration support #1134

sdeleuze opened this issue Oct 5, 2021 · 9 comments
Labels
type: enhancement A general enhancement
Milestone

Comments

@sdeleuze
Copy link
Contributor

sdeleuze commented Oct 5, 2021

To be discussed with @artembilan and @snicoll.

@sdeleuze sdeleuze added the type: task A general task label Oct 5, 2021
@sdeleuze sdeleuze added this to the 0.11.0-M2 milestone Oct 5, 2021
artembilan added a commit to artembilan/spring-native that referenced this issue Oct 22, 2021
Fixes spring-attic#1155
Related to spring-attic#1134

The `FactoryBean.OBJECT_TYPE_ATTRIBUTE` is crucial for those `FactoryBean` impls
which does not expose the target type during compilation.

* Add `FactoryBean.OBJECT_TYPE_ATTRIBUTE` as a candidate for the
`DefaultBeanRegistrationWriter.getAttributeFilter()` since that one is `false` by default anyway
* Rework `IntegrationApplication` to reflect the current Spring Boot state
* Use `spring-integration-5.5.6-SNAPSHOT` for the latest bean definition changes over there

The `build.sh -a` now passes for the integration sample.
Cannot confirm in the native mode since GraalVM doesn't work well on Windows: too long command line.
Need to build classpath file (jar with respective META-INF) somehow...
artembilan added a commit to artembilan/spring-native that referenced this issue Oct 28, 2021
Fixes spring-attic#1155
Related to spring-attic#1134

The `FactoryBean.OBJECT_TYPE_ATTRIBUTE` is crucial for those `FactoryBean` impls
which does not expose the target type during compilation.

* Add `FactoryBean.OBJECT_TYPE_ATTRIBUTE` as a candidate for the
`DefaultBeanRegistrationWriter.getAttributeFilter()` since that one is `false` by default anyway
* Rework `IntegrationApplication` to reflect the current Spring Boot state
* Use `spring-integration-5.5.6-SNAPSHOT` for the latest bean definition changes over there

The `build.sh -a` now passes for the integration sample.
Cannot confirm in the native mode since GraalVM doesn't work well on Windows: too long command line.
Need to build classpath file (jar with respective META-INF) somehow...
@sdeleuze sdeleuze modified the milestones: 0.11.0-M2, 0.11.0-RC1 Nov 2, 2021
@snicoll
Copy link
Contributor

snicoll commented Nov 4, 2021

We've made quite a lot of progress. The integration sample now starts in AOT mode but is failing on Native because some annotation hints are missing.

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.example.integration.IntegrationApplication': Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: A channel name in 'inputChannel' is required when interface org.springframework.integration.annotation.ServiceActivator is used on '@Bean' methods.

Artem said he'd be following up. @artembilan let me know if I can help.

@sdeleuze
Copy link
Contributor Author

sdeleuze commented Nov 5, 2021

Awesome, thanks a lot @snicoll.

@sdeleuze
Copy link
Contributor Author

sdeleuze commented Nov 8, 2021

I am moving this one to 0.11.0 in order to allow us to focus on testing which is the highest priority.

@sdeleuze sdeleuze modified the milestones: 0.11.0-RC1, 0.11.0 Nov 8, 2021
@snicoll
Copy link
Contributor

snicoll commented Nov 8, 2021

Spring Integration used to work on AOT and now doesn't anymore so I think we need to make sure we fix that first by not changing things in Spring Integration (or fixing them if they have to be).

The sample fails currently with:

2021-11-08 09:54:19.410  INFO 13418 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.integration.config.IntegrationManagementConfiguration' of type [org.springframework.integration.config.IntegrationManagementConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-11-08 09:54:19.430  INFO 13418 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'integrationChannelResolver' of type [org.springframework.integration.support.channel.BeanFactoryChannelResolver] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-11-08 09:54:19.432  INFO 13418 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'integrationDisposableAutoCreatedBeans' of type [org.springframework.integration.config.annotation.Disposables] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-11-08 09:54:19.671  INFO 13418 --- [           main] o.s.j.d.e.EmbeddedDatabaseFactory        : Starting embedded database: url='jdbc:h2:mem:d748fea7-eb9f-4316-817f-59fd975a0704;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=false', username='sa'
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.springframework.util.ReflectionUtils (jar:file:/Users/snicoll/workspace/work/experimental/spring-native/samples/integration/target/integration-0.0.1-SNAPSHOT.jar!/BOOT-INF/lib/spring-core-5.3.13-SNAPSHOT.jar!/) to constructor java.lang.invoke.MethodHandles$Lookup(java.lang.Class)
WARNING: Please consider reporting this to the maintainers of org.springframework.util.ReflectionUtils
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
2021-11-08 09:54:20.894  WARN 13418 --- [           main] .r.c.ReactiveWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'integrationMessageHandlerMethodFactory': Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'java.util.ImmutableCollections$ListN' to required type 'java.util.List' for property 'customArgumentResolvers'; nested exception is java.lang.IllegalStateException: Cannot convert value of type 'org.springframework.beans.factory.support.RootBeanDefinition' to required type 'org.springframework.messaging.handler.invocation.HandlerMethodArgumentResolver' for property 'customArgumentResolvers[0]': no matching editors or conversion strategy found
2021-11-08 09:54:20.914  INFO 13418 --- [           main] o.s.j.d.e.EmbeddedDatabaseFactory        : Shutting down embedded database: url='jdbc:h2:mem:d748fea7-eb9f-4316-817f-59fd975a0704;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=false'
2021-11-08 09:54:21.147 ERROR 13418 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'integrationMessageHandlerMethodFactory': Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'java.util.ImmutableCollections$ListN' to required type 'java.util.List' for property 'customArgumentResolvers'; nested exception is java.lang.IllegalStateException: Cannot convert value of type 'org.springframework.beans.factory.support.RootBeanDefinition' to required type 'org.springframework.messaging.handler.invocation.HandlerMethodArgumentResolver' for property 'customArgumentResolvers[0]': no matching editors or conversion strategy found
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:628) ~[spring-beans-5.3.13-SNAPSHOT.jar!/:5.3.13-SNAPSHOT]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.13-SNAPSHOT.jar!/:5.3.13-SNAPSHOT]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.13-SNAPSHOT.jar!/:5.3.13-SNAPSHOT]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.13-SNAPSHOT.jar!/:5.3.13-SNAPSHOT]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.13-SNAPSHOT.jar!/:5.3.13-SNAPSHOT]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.13-SNAPSHOT.jar!/:5.3.13-SNAPSHOT]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:944) ~[spring-beans-5.3.13-SNAPSHOT.jar!/:5.3.13-SNAPSHOT]
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) ~[spring-context-5.3.13-SNAPSHOT.jar!/:5.3.13-SNAPSHOT]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.13-SNAPSHOT.jar!/:5.3.13-SNAPSHOT]
	at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.refresh(ReactiveWebServerApplicationContext.java:64) ~[spring-boot-2.6.0-SNAPSHOT.jar!/:2.6.0-SNAPSHOT]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:719) ~[classes!/:0.0.1-SNAPSHOT]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:401) ~[classes!/:0.0.1-SNAPSHOT]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:302) ~[classes!/:0.0.1-SNAPSHOT]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1290) ~[classes!/:0.0.1-SNAPSHOT]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1279) ~[classes!/:0.0.1-SNAPSHOT]
	at com.example.integration.IntegrationApplication.main(IntegrationApplication.java:50) ~[classes!/:0.0.1-SNAPSHOT]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
	at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
	at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49) ~[integration-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
	at org.springframework.boot.loader.Launcher.launch(Launcher.java:108) ~[integration-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
	at org.springframework.boot.loader.Launcher.launch(Launcher.java:58) ~[integration-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
	at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88) ~[integration-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
Caused by: org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'java.util.ImmutableCollections$ListN' to required type 'java.util.List' for property 'customArgumentResolvers'; nested exception is java.lang.IllegalStateException: Cannot convert value of type 'org.springframework.beans.factory.support.RootBeanDefinition' to required type 'org.springframework.messaging.handler.invocation.HandlerMethodArgumentResolver' for property 'customArgumentResolvers[0]': no matching editors or conversion strategy found
	at org.springframework.beans.AbstractNestablePropertyAccessor.convertIfNecessary(AbstractNestablePropertyAccessor.java:595) ~[spring-beans-5.3.13-SNAPSHOT.jar!/:5.3.13-SNAPSHOT]
	at org.springframework.beans.AbstractNestablePropertyAccessor.convertForProperty(AbstractNestablePropertyAccessor.java:609) ~[spring-beans-5.3.13-SNAPSHOT.jar!/:5.3.13-SNAPSHOT]
	at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:219) ~[spring-beans-5.3.13-SNAPSHOT.jar!/:5.3.13-SNAPSHOT]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1756) ~[spring-beans-5.3.13-SNAPSHOT.jar!/:5.3.13-SNAPSHOT]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1712) ~[spring-beans-5.3.13-SNAPSHOT.jar!/:5.3.13-SNAPSHOT]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1452) ~[spring-beans-5.3.13-SNAPSHOT.jar!/:5.3.13-SNAPSHOT]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:619) ~[spring-beans-5.3.13-SNAPSHOT.jar!/:5.3.13-SNAPSHOT]
	... 23 common frames omitted
Caused by: java.lang.IllegalStateException: Cannot convert value of type 'org.springframework.beans.factory.support.RootBeanDefinition' to required type 'org.springframework.messaging.handler.invocation.HandlerMethodArgumentResolver' for property 'customArgumentResolvers[0]': no matching editors or conversion strategy found
	at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:262) ~[spring-beans-5.3.13-SNAPSHOT.jar!/:5.3.13-SNAPSHOT]
	at org.springframework.beans.TypeConverterDelegate.convertToTypedCollection(TypeConverterDelegate.java:528) ~[spring-beans-5.3.13-SNAPSHOT.jar!/:5.3.13-SNAPSHOT]
	at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:176) ~[spring-beans-5.3.13-SNAPSHOT.jar!/:5.3.13-SNAPSHOT]
	at org.springframework.beans.AbstractNestablePropertyAccessor.convertIfNecessary(AbstractNestablePropertyAccessor.java:590) ~[spring-beans-5.3.13-SNAPSHOT.jar!/:5.3.13-SNAPSHOT]
	... 29 common frames omitted

@snicoll
Copy link
Contributor

snicoll commented Nov 21, 2021

Running the integration samples now leads to:


***************************
APPLICATION FAILED TO START
***************************

Description:

The bean 'integrationDisposableAutoCreatedBeans' could not be registered. A bean with that name has already been defined and overriding is disabled.

Action:

Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true

I suspect that something has been called at build time and is called again at runtime and attempt to register a bean that's already there. @artembilan do you have some cycles to resume this? I intend to spend a bit of time next week on this so any insight would be much appreciated.

artembilan added a commit to artembilan/spring-native that referenced this issue Nov 29, 2021
Fixes spring-attic#1134

* Upgrade sample to the latest Spring Integration `5.5.7-SNAPSHOT`
* Add `maven-shade-plugin` and `native-maven-plugin` under Windows profile
to make native image build working on Windows.
Se more info in Native Build Tools docs:
https://graalvm.github.io/native-build-tools/latest/maven-plugin.html#long_classpath_and_shading_support
This profile simply can go to the `../maven-parent/pom.xml` to make all the samples working on Windows.
Or you can remove this on merge since it might be just a noise for a broader community
* Add custom `ReactorClientHttpConnector` bean into the sample app, since by default a DNS resolver
fails with NPE on Windows in native image.
See more info in the: spring-projects/spring-framework#27749
* Add more type nints into the `IntegrationHints`
@sdeleuze sdeleuze modified the milestones: 0.11.0, 0.11.1 Nov 30, 2021
@sdeleuze
Copy link
Contributor Author

Require at least Spring Integration 5.5.7.

sdeleuze pushed a commit that referenced this issue Nov 30, 2021
* Upgrade sample to the latest Spring Integration `5.5.7-SNAPSHOT`
* Add more type hints into the `IntegrationHints`

See gh-1134
@snicoll
Copy link
Contributor

snicoll commented Nov 30, 2021

Technically this would work for anyone using 0.10.0 and overriding the spring integration version to use. I agree we shouldn't claim it's compatible but if no other changes are required, maybe we could close this one?

@sdeleuze
Copy link
Contributor Author

sdeleuze commented Dec 1, 2021

We could but I thought it would be better to keep it open until we remove the version override in order to have it mentioned in the changelog when effectively supported out of the box (I guess you meant 0.11.0).

@snicoll
Copy link
Contributor

snicoll commented Dec 1, 2021

Yes sorry I meant 0.11.0. Spring Native does not provide dependency management and if nothing here is required, it's a bit artificial to keep the issue open. If Spring Integration ships its version in Spring Boot 2.6.2, then there is no need for a 0.10.1 release to make this work...

@sdeleuze sdeleuze modified the milestones: 0.11.1, 0.11.0 Dec 1, 2021
@sdeleuze sdeleuze closed this as completed Dec 1, 2021
@snicoll snicoll added type: enhancement A general enhancement and removed type: task A general task labels Dec 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: enhancement A general enhancement
Development

Successfully merging a pull request may close this issue.

2 participants