I’m having trouble integrating Flux into my codeba...
# spring
h
I’m having trouble integrating Flux into my codebase:
Copy code
val inputStream: InputStream = URL(attachmentURL).openStream()
val buffer = DataBufferUtils.readInputStream(
    { inputStream },
    DefaultDataBufferFactory(),
    8192
)
I’ve integrated the following dependency into my project:
Copy code
implementation(group = "io.projectreactor", name = "reactor-core", version = "3.3.10.RELEASE")
But i’m getting this error:
Copy code
Cannot access class 'reactor.core.publisher.Flux'. Check your module classpath for missing or conflicting dependencies
highlighted on readInputStream Am I missing something?
Copy code
/**
 * Obtain a {@link InputStream} from the given supplier, and read it into a
 * {@code Flux} of {@code DataBuffer}s. Closes the input stream when the
 * Flux is terminated.
 * @param inputStreamSupplier the supplier for the input stream to read from
 * @param bufferFactory the factory to create data buffers with
 * @param bufferSize the maximum size of the data buffers
 * @return a Flux of data buffers read from the given channel
 */
public static Flux<DataBuffer> readInputStream(
      Callable<InputStream> inputStreamSupplier, DataBufferFactory bufferFactory, int bufferSize) {

   Assert.notNull(inputStreamSupplier, "'inputStreamSupplier' must not be null");
   return readByteChannel(() -> Channels.newChannel(inputStreamSupplier.call()), bufferFactory, bufferSize);
}
No idea what’s happening here:
a
I started to do basically the same thing yesterday with one of my projects and encountered exactly the same issue. So far, Stackoverflow has been no help...
I tried to follow one of @sdeleuze’s examples to the letter - no improvement
I'm using: SpringBoot 2.3.4.RELEASE Kotlin 1.4.10 Kotlin Coroutines 1.3.9 and Coroutines Reactor 1.3.9
I have only the
spring-boot-starter-webflux
on the class path, having removed
...-web
OK, I resolved what this issue is, but do not have a full solution yet. 1.) The missing reference to
Flux
in my project was due to a mis-placement of the Coroutines Reactor dependency in the gradle build file (I have multi-module project and I had added to one sub-project and not another).
But then a second issue came up
2.) I started seeing "Unsupported suspending function" errors.
This turned out to be the result of my need to include a dependency for Keycloak (OIDC/OAuth2 provider). Keycloak's
keycloak-spring-starter
library dependes on
spring-boot-starter-web:2.0.5
for some reason. WebFlux won't bind properly if the
-web
dependency is present. Excluding the ``spring-boot-starter-web:2.0.5` library from the gradle build resulting in many missing references.
I am still working on a work-around for this rabbit hole