所以假设我有一个现有的应用程序有两个端点/人和/裤子.呼叫GET /人员返回:
[
{
"name":"john",
"age":37,
"pants":[
{
"color":"green",
"brand":"levis",
"size":"medium"
},
{
"color":"indigo",
"brand":"jncos",
"size":"medium-with-huge-legs"
}
]
},
{
"name":"june",
"age":23,
"pants":[
{
"color":"pink",
"brand":"gap",
"size":"small"
}
]
}
]
Run Code Online (Sandbox Code Playgroud)
如果我使用Spring Data Rest并拨打GET/person,我会收到类似的信息:
{
"_links":{
"next":{
"href":"http://myapp.com/people?page=1&size=20"
},
"self":{
"href":"http://myapp.com/people{&page,size,sort}",
"templated":true
},
"search":{
"href":"http://myapp.com/people/search"
}
},
"_embedded":{
"people":[
{
"name":"john",
"age":37,
"_links":{
"self":{
"href":"http://myapp.com/people/john"
},
"pants":{
"href":"http://myapp.com/people/john/pants"
}
}
},
{
"name":"june",
"age":23,
"_links":{
"self":{
"href":"http://myapp.com/people/june"
},
"pants":{
"href":"http://myapp.com/people/june/pants"
}
}
}
]
}
}
Run Code Online (Sandbox Code Playgroud)
假设我有一堆我不想改变的现有客户端 - 在某些情况下是否有任何方法可以禁用响应的超媒体部分(比如Accept ="application/json")但是为了启用它们其他人(Accept …
我创建了一个用于模拟soap服务的Spring Boot项目 - 它依赖于 org.springframework.ws:spring-ws-security
处理ws-sec标头,这引入了对org.springframework.security:spring-security-core
在我的运行时类路径上使用它会导致 Spring Boot 认为我想要启用 Web 安全性,即使我禁用它,security.basic.enabled = false
我最终也会收到运行时 ClassNotFound 异常,除非我还添加:
compile("org.springframework.security:spring-security-web:$springSecurityVersion")
compile("org.springframework.security:spring-security-config:$springSecurityVersion")
Run Code Online (Sandbox Code Playgroud)
到我的运行时类路径。有什么方法可以向 Boot 表明,虽然它在运行时位于类路径上,但我真的不想与 Spring Security 有任何关系,并使其不需要这些额外的依赖项?