java - Jersey 3.0.1 - 无法从 FormDataBodyPart 获取 MediaType
问题描述
我已将我在 gradle 中的项目依赖项从 compile("org.glassfish.jersey.media:jersey-media-multipart:2.3.2") 更新为 compile("org.glassfish.jersey.media:jersey-media-multipart:3.0 .1")
我收到以下错误,试图检查代码以查看是否会指向从 FormDataBodyPart 获取 MediaType 的方向,但无法弄清楚,我应该在哪里获得 Jersey 3 中的 Mediatype?
private boolean isFileChecksOk(FormDataContentDisposition fileDisposition, FormDataBodyPart body, byte[] bytes) {
boolean mediaTypeOk = body.getMediaType().getSubtype().equalsIgnoreCase(excelMediaType);
...
...
}
error: cannot access MediaType
boolean mediaTypeOk = body.getMediaType().getSubtype().equalsIgnoreCase(excelMediaType);
^
class file for jakarta.ws.rs.core.MediaType not found
build.gradle 依赖:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:2.4.3")
}
}
dependencies {
implementation 'junit:junit:4.13.2'
compile("org.springframework.boot:spring-boot-starter-security")
compile("org.springframework.boot:spring-boot-starter-jersey")
compile("org.springframework.boot:spring-boot-starter-web")
compile("org.springframework.boot:spring-boot-starter-thymeleaf")
compile("org.springframework.boot:spring-boot-starter-data-jpa")
compile("org.springframework.boot:spring-boot-starter-jetty")
compile("org.springframework.boot:spring-boot-starter-mail")
compile("org.springframework.boot:spring-boot-starter-actuator")
compile("com.fasterxml.jackson.dataformat:jackson-dataformat-xml")
compile("com.fasterxml.jackson.datatype:jackson-datatype-jsr310")
compile("com.fasterxml.woodstox:woodstox-core:6.2.4")
compile("org.glassfish.jersey.media:jersey-media-multipart:3.0.1")
compile("net.java.dev.msv:msv-core:2013.6.1")
compile("com.impossibl.pgjdbc-ng:pgjdbc-ng:0.8.6")
compile('org.apache.commons:commons-lang3:3.12.0')
compile('commons-io:commons-io:2.8.0')
compile('org.apache.commons:commons-compress:1.20')
compile('org.apache.poi:poi-ooxml:4.1.2')
compile('org.apache.xmlbeans:xmlbeans:3.1.0')
compile('com.monitorjbl:xlsx-streamer:2.1.0')
compile('com.zaxxer:HikariCP')
compile("org.quartz-scheduler:quartz:2.3.2"){
exclude group: 'com.zaxxer', module: 'HikariCP-java7'
}
compile('no.applikativ:twistgrid-builder:2.0.0')
compile('org.apache.tika:tika-parsers:1.25')
testCompile("org.springframework.boot:spring-boot-starter-test")
slowtestCompile("org.latencyutils:LatencyUtils:2.0.3") slowtestCompile("org.junit.platform:junit-platform-console-standalone:1.7.0")
}
TIA
解决方案
推荐阅读
- angular - 为什么 TypeScript 不从函数签名中推断类型?
- database - 有没有办法在 Oracle SQL Developer 中查看一列的关系?
- c# - '' 不是 3 of 9 标准条码的有效代码
- events - 如何使用 SwiftUI 和 Combine 检测 Datepicker 的值变化?
- node.js - 为什么 npm start 会抛出 events.js:187 throw er; // 我的反应项目中未处理的“错误”事件?
- php - Laravel 查询运行两次
- react-native - WebView 在使用 React Native 的 ios 中不起作用
- python - 列出可用 Celery 任务名称和简要描述的 API
- performance - 哪个 Lua 函数更好用?
- c - 为什么“if (!(NULL != result))”比“if (NULL == result)”更好