Spring Boot 3 webflux is not compatible with springdoc openapi 2 - spring-boot

I add bellow codes in my build.gradle:
...
implementation 'org.springframework.boot:spring-boot-starter-webflux:3.0.2'
implementation group: 'org.springdoc', name: 'springdoc-openapi-starter-webflux-ui', version: '2.0.2'
...
I tried by add:
implementation 'org.springframework.boot:spring-boot-starter-web'
but not working too
and when I have spring boot web with following dependency everything worked for me:
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.0.2'
Do you have any idea?

Related

springdoc-openapi-ui not working with spring version 3.0.0-SNAPSHOT

id 'org.springframework.boot' version '3.0.0-SNAPSHOT'
implementation group: 'org.springdoc', name: 'springdoc-openapi-ui', version: '1.6.12'
I want to use springdoc-openapi-ui with springboot 3.0.0-SNAPSHOT. But swagger not working. It works with springboot version 2.7.5
http://localhost:8080/user/swagger-ui/index.html#/ - swagger url
Bump the version of your org.springdoc to version: 2.0.2.
And instead of using springdoc-openapi-ui use springdoc-openapi-starter-webmvc-ui.
For detailed changes in Springdoc v2, refer to the documentation at https://springdoc.org/v2/#features
I've faced same issue and solved it by adding webflux dependency as well
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.0.2'
implementation 'org.springdoc:springdoc-openapi-webflux-ui:1.6.14'

How to use spring boot in gradle without the spring boot gradle plugin

Can anyone show me or point me to a spring boot gradle project that does not make use of the spring boot gradle plugin.
I'm looking for something like a spring boot starter web hello world example that doesn't use the gradle plugin.
I can't imagine that the plugin is a requirement, but a search for examples all seem to lean on the gradle plugin, which lets just say is not an option in my environment, and no I can't switch to maven either.
Ideally the gradle build would work by adding something like the following:
gradle.properties
springBootVersion=2.1.3.RELEASE
build.gradle
dependencies {
compile group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: springBootVersion
}
I used the spring dependency management plugin, and it works
buildscript {
ext {
springDepManagementVersion = '1.0.10.RELEASE'
springBootVersion = '2.6.6'
springCloudVersion = "2021.0.1"
}
dependencies {
classpath "io.spring.gradle:dependency-management-plugin:${springDepManagementVersion}"
}
}
apply plugin: 'io.spring.dependency-management'
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
mavenBom "org.springframework.boot:spring-boot-dependencies:${springBootVersion}"
}
}
dependencies {
implementation "org.springframework.cloud:spring-cloud-starter-sleuth"
implementation 'org.springframework.boot:spring-boot-starter-json'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-mail'
implementation 'org.springframework.boot:spring-boot-starter-security'
...
}
I can't use spring boot gradle plugin, since I can only use gradle 6.7.1, while spring boot gradle plugin requires gradle version at least 6.8 to support spring boot 2.6. I was inspired by the spring cloud bom solution.

Spark integration with spring boot web starter

I am trying to integrate Spark application with spring boot but since spark core also has jetty server and servlet packages, they are conflicting with spring boot web starter servlet packages.
I already followed the post below to exclude starter-logging
https://www.linkedin.com/pulse/integrating-spark-spring-boot-neeraj-malhotra
I tried excluding servlet from spark core package, but it wouldn't start up or build using gradle build.
My goal is to run this app as a Rest API using spring boot web starter.
Thanks
I found the solution a long time ago, but couldn't post this.
I had to exclude a bunch of packages from spark-core that contain servlet packages
compile(group: 'org.apache.spark', name: 'spark-core_2.11', version: '1.6.0') {
exclude group: 'org.slf4j', module: 'slf4j-simple'
exclude group: 'org.eclipse.jetty', module: 'jetty-server'
exclude group: 'com.sun.jersey', module: 'jersey-server'
exclude group: 'com.sun.jersey', module: 'jetty-core'
exclude group: 'org.eclipse.jetty.orbit', module: 'javax.servlet'
//exclude group: 'org.eclipse.jetty', module: 'jetty-server'
}

Opentok SDK not Spring-boot compliant due new Jackson 2.9 release

My Spring-boot application started failing once Jackson 2.9 was released on 2nd of March. I am using Gradle for building and Spring boot version 1.5.2 which depends on Jackson-core 2.8.7.
In addition I need Opentok SDK which I have added as dependency:
compile group: 'com.tokbox', name: 'opentok-server-sdk', version: '2.3.2'
I suppose the reason is the Opentok SDK dependency definition which allows downloading newer JAR for Jackson which then creates a mismatch of libraries as several versions of Jackson JARs are downloaded:
https://github.com/opentok/Opentok-Java-SDK/blob/master/build.gradle
dependencies {
...
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '[2.3.1,2.99999)'
How to sort this out?
I am not an expert of Gradle but could I somehow force Opentok to use 2.8.7 version?
I cannot deliver at the moment at all so please help.
I think this should be useful: https://docs.gradle.org/current/userguide/dependency_management.html#sub:version_conflicts
As well as the guide here: https://docs.gradle.org/current/dsl/org.gradle.api.artifacts.dsl.DependencyHandler.html#N1627D
Approaches might differ, but you can set Gradle to force = true for Spring's jackson-databind dependency.
This is how I sorted it out
compile ('com.tokbox:opentok-server-sdk:2.3.2')
{
// Jackson 2.9 is not compatible with Spring boot 1.4.4 - 1.5.2
exclude group: 'com.fasterxml.jackson.core', module: 'jackson-databind'
}

Importing RestAssured in Spring Boot Test

I have developed a Spring Boot Application.
I am using RestAssured to test the same
following are the dependencies in build.gradle
dependencies {
compile("org.springframework.boot:spring-boot-starter-actuator")
compile("org.springframework.boot:spring-boot-starter-aop")
compile("org.springframework.boot:spring-boot-starter-data-jpa")
compile("org.springframework.boot:spring-boot-starter-mail")
compile("org.springframework.boot:spring-boot-starter-security")
compile("org.springframework.boot:spring-boot-starter-thymeleaf")
compile("org.thymeleaf.extras:thymeleaf-extras-springsecurity3:2.1.2.RELEASE")
compile("org.springframework.boot:spring-boot-starter-web")
compile("org.springframework.boot:spring-boot-starter-freemarker")
compile("org.springframework.boot:spring-boot-starter-thymeleaf")
runtime("mysql:mysql-connector-java")
testCompile("org.springframework.boot:spring-boot-starter-test")
testCompile('com.jayway.restassured:rest-assured:2.4.1')
}
I am facing a problem while importing RestAssured in a Integration Test class for Spring Boot
import static com.jayway.restassured.RestAssured.*;
When I try to run the application using gradle I am getting the following error
Error:(15, 37) java: package com.jayway.restassured does not exist
Why is this problem and how to solve it ?

Resources