Skip to content
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

check for both Spring MVC and for Spring WebFlux when deciding to register the Integration Graph controller #2358

Closed
joshlong opened this issue Feb 11, 2018 · 2 comments

Comments

@joshlong
Copy link
Member

IntegrationGraphControllerRegistrarImportSelector checks for the DispatcherServlet, which fails in a Spring WebFlux application. I copied and pasted the relevant code to a separate class hiearchy, commented out the test for Spring MVC and then ran it in a Spring WebFlux app, and it seems to work.

@garyrussell
Copy link
Contributor

Contributions are welcome 😄

@artembilan
Copy link
Member

In the WebFlux module we use the code like:

	/**
	 * The {@code boolean} flag to indicate if the
	 * {@code org.springframework.web.reactive.result.method.RequestMappingInfo}
	 * is present in the CLASSPATH to allow to register the Integration server reactive components.
	 */
	public static final boolean WEB_FLUX_PRESENT =
			ClassUtils.isPresent("org.springframework.web.reactive.result.method.RequestMappingInfo",
					WebFluxContextUtils.class.getClassLoader());

to indicate that we are good to go with the WebFlux server components registration.

I don't think that we need to do one class in this webflux module.
I think as the fix there should be enough to add similar condition to the IntegrationGraphControllerRegistrarImportSelector:

if (HttpContextUtils.WEB_MVC_PRESENT || WEB_FLUX_PRESENT) {
	return new String[] { IntegrationGraphControllerRegistrar.class.getName() };
}

The JavaDocs of the @EnableIntegrationGraphController should be improved respectively.

That will work properly just because spring-integration-http is direct dependency of of the spring-integration-webflux.

artembilan added a commit to artembilan/spring-integration that referenced this issue Feb 13, 2018
Fixes spring-projects#2358

The WebFlux on the server side can deal with MVC `@Controllers` as well
without any Servlet environment.

* Enable `IntegrationGraphController` when we not only in the
Servlet environment, but also in the WebFlux
* Upgrade to SF-5.0.4 and fix WebFlux tests to meet the latest requirements
* Move `WEB_FLUX_PRESENT` to the `HttpContextUtils`;
deprecate it in the `WebFluxContextUtils`
* Mention WebFlux ability for the `IntegrationGraphController` in the
`graph.adoc`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants