ошибка spring-web-flux с отключенным netty Reflective setAccessible (true)

У меня есть тест junit, как указано выше, но когда я запускаю тест, я получаю эту ошибку (JDK 13.0.1):

java.lang.UnsupportedOperationException: Reflective setAccessible(true) disabled
java.lang.IllegalAccessException: class io.netty.util.internal.PlatformDependent0$6 cannot access class jdk.internal.misc.Unsafe (in module java.base) because module java.base does not export jdk.internal.misc to unnamed module @4a94ee4

Мой инструмент - Intellij CE Edition 2019.3.1. Это мой класс и файл pom:

    import org.junit.jupiter.api.Assertions;
    import org.junit.jupiter.api.Test;
    import org.springframework.web.reactive.function.client.WebClient;
    import reactor.core.publisher.Flux;

    class WebClientStockClientIntegrationTest {

        private static final String SYMBOL = "EUR";
        private WebClient webClient = WebClient.builder().build();

        @Test
        void shouldRetrieveStockPricesFromStockService() {
            WebClientStockClient webClientStockClient = new WebClientStockClient(webClient);
            Flux<StockPrice> prices = webClientStockClient.pricesFor(SYMBOL);
            Assertions.assertNotNull(prices);
            Assertions.assertTrue(prices.take(5).count().block() > 0);
        }
}

Мой пом с пружинной загрузкой и зависимостями:

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.2.2.RELEASE</version>
        ..

    <properties>
        <java.version>11</java.version>
    </properties>

person robyp7    schedule 19.12.2019    source источник


Ответы (1)


Решил: добавляю:

--add-opens java.base/jdk.internal.misc=ALL-UNNAMED -Dio.netty.tryReflectionSetAccessible=true

к моей тестовой конфигурации

введите описание изображения здесь

person robyp7    schedule 19.12.2019