我正在使用Spring Boot 1.3.0。我想创建一个休息端点,该端点产生“ application / hal + json”类型的内容。
我收到“不受支持的媒体类型”异常。 Spring Boot 1.3.0不支持这种媒体类型吗?
谁能让我知道支持哪个春季启动版本?
我正在使用Gradle。 @RequestMapping(值= Array(“ / grouping”),消耗= Array(MediaType.APPLICATION_JSON_VALUE),产生= Array(MediaType.APPLICATION_JSON_VALUE,“ application / hal + json”),方法= Array(RequestMethod.GET,RequestMethod.DELETE ))def processGroupingGetDelRequest(request:HttpServletRequest):ResponseEntity [Object] = {}
我的Gradle文件 依赖项{ //这是在Jenkins机器上安装Fortify的路径。要运行本地交换线路。 强化fileTree(dir:'/opt/HP_Fortify/HP_Fortify_SCA_and_Apps_4.21/Core/lib',包括:' .jar') // fortify fileTree(dir:'C:/ Program Files / HP_Fortify / HP_Fortify_SCA_and_Apps_4.21 / Core / lib /',包括:' .jar')
compile group: 'org.springframework', name: 'spring-mock', version: '2.0.8'
compile group: 'org.scala-lang', name: 'scala-library', version: '2.11.7'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: '1.3.3.RELEASE'
/* the following pulls in: spring-orm, hibernate-entity-manager, spring-data-jpa: */
compile('org.springframework.boot:spring-boot-starter-data-jpa:1.3.0.RELEASE') {
exclude group: 'org.apache.tomcat', module: 'tomcat-jdbc'
}
compile('com.zaxxer:HikariCP:2.6.1') {
exclude group: 'org.hibernate', module: 'hibernate-core'
}
/* the following pulls in: spring-jdbc, spring-tx, tomcat-jdbc: */
/* See: http://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-sql.html */
/* You need a dependency on spring-jdbc for an embedded database to be auto-configured. */
/* It�s pulled in transitively via spring-boot-starter-data-jpa. */
// compile group: 'org.springframework.boot', name:'spring-boot-starter-jdbc'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-security', version: '1.3.0.RELEASE'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-log4j2', version: '1.3.0.RELEASE'
compile group: 'org.springframework', name: 'spring-jms', version: '4.2.3.RELEASE'
compile group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-yaml', version: '2.8.6'
compile group: 'com.fasterxml.jackson.module', name: 'jackson-module-scala_2.11', version: '2.8.6'
compile group: 'org.glassfish.jersey.core', name: 'jersey-common', version: '2.22.1'
compile group: 'org.glassfish.jersey.core', name: 'jersey-client', version: '2.22.1'
compile group: 'org.glassfish.jersey.media', name: 'jersey-media-json-jackson', version: '2.22.1'
compile group: 'org.glassfish.jersey.bundles.repackaged', name: 'jersey-guava', version: '2.22.1'
compile group: 'org.springframework.security', name: 'spring-security-ldap', version: '4.2.1.RELEASE'
compile group: 'org.springframework.security', name: 'spring-security-core', version: '4.2.1.RELEASE'
compile group: 'org.springframework.security', name: 'spring-security-config', version: '4.2.1.RELEASE'
compile group: 'org.springframework.security', name: 'spring-security-web', version: '4.2.1.RELEASE'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version:'2.8.6'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-core', version:'2.8.6'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version:'2.8.6'
compile group: 'com.fasterxml.jackson.module', name: 'jackson-module-jaxb-annotations', version: '2.8.6'
compile group: 'com.fasterxml.jackson.jaxrs', name: 'jackson-jaxrs-base', version:'2.8.6'
compile group: 'com.fasterxml.jackson.jaxrs', name: 'jackson-jaxrs-json-provider', version:'2.8.6'
compile group: 'com.fasterxml.jackson.module', name: 'jackson-module-paranamer', version: '2.8.6'
// compile group: 'org.hibernate', name: 'hibernate-jpamodelgen'
// https://mvnrepository.com/artifact/com.typesafe.play/play-json_2.11
compile group: 'com.typesafe.play', name: 'play-json_2.11', version: '2.3.10'
providedCompile group: 'com.h2database', name: 'h2', version: '1.4.196'
providedCompile group: 'org.apache.activemq', name: 'activemq-broker', version: '5.12.1'
providedRuntime group: 'org.springframework.boot', name: 'spring-boot-starter-tomcat', version: '1.3.0.RELEASE'
//Note: Un-comment if in Development the tomcat dependencies are not resolved during the spring boot runs
//providedRuntime group: 'org.apache.tomcat.embed', name: 'tomcat-embed-core', version: '8.5.11'
scoverage 'org.scoverage:scalac-scoverage-plugin_2.11:1.1.1', 'org.scoverage:scalac-scoverage-runtime_2.11:1.1.1'
testCompile group: 'junit', name: 'junit', version: '4.11'
testCompile group: 'org.scalatest', name: 'scalatest_2.11', version: '2+'
testCompile group: 'org.mockito', name: 'mockito-all', version: '1.10.19'
testCompile group: 'org.springframework', name: 'spring-test', version:'4.2.3.RELEASE'
testRuntime 'org.pegdown:pegdown:1.1.0'
}
我的控制器类
@RequestMapping(值= Array(“ / grouping”),消耗= Array(MediaType.APPLICATION_JSON_VALUE),产生= Array(MediaType.APPLICATION_JSON_VALUE,“ application / hal + json”),方法= Array(RequestMethod.GET, RequestMethod.DELETE)) def processGroupingGetDelRequest(请求:HttpServletRequest):ResponseEntity [Object] = {
val requestDetails = extractRequestInformation(request)
val response = Service.processGroupingRequest(requestDetails.uri, requestDetails.httpMethod, requestDetails.queryParameters, "")
new ResponseEntity[Object](response, HttpStatus.OK)
}