10得票1回答
Spring Boot: 使用Spring Social和Spring Security保护RESTful API

我正在尝试使用Spring Boot定义和保护RESTful API。理想情况下,我希望使用Spring Social,并允许客户端(Web和移动)通过Facebook登录。 目前已经实现的内容 到目前为止,我已经成功使用@RestController创建了一个API,并使用基本的Spring...

8得票2回答
如何使用Spring REST消费protobuf参数?

我试图将protobuf参数传递给一个REST端点,但每次尝试时都会收到以下错误信息:org.springframework.web.client.HttpServerErrorException: 500 null目前我的代码如下: @RestController public class...

11得票2回答
在响应式Spring Webflux REST控制器中的重定向

我正在为Spring Reactive项目创建一个简单的控制器服务器。在设置重定向到另一个位置时,当调用http://localhost:8080/时,发现了一个错误: There was an unexpected error (type=Internal Server Error, st...

58得票3回答
@RequestMapping注解中path和value属性的区别

以下两个属性有什么区别,应该在什么情况下使用哪一个?@GetMapping(path = "/usr/{userId}") public String findDBUserGetMapping(@PathVariable("userId") String userId) { return ...

10得票2回答
Spring 4 AOP @Aspect对于@RestController没有触发

我已经创建了一个 Aspect,在基本的 id 比较中进行操作,以确保用户属于请求实体所属的同一组。我已经成功将我的 aspect 附加到 @Service 方法上,但在服务层这样做没有意义,我需要将其附加到 @RestController 方法上。当我尝试这样做时,一切似乎都很好,但我的 A...

14得票2回答
Spring MVC RestController 范围

我有以下的Spring控制器:package hello; import java.util.concurrent.atomic.AtomicLong; import org.springframework.web.bind.annotation.RequestMapping; impor...

32得票5回答
Spring Boot无法自动注入@ConfigurationProperties

这是我的FileStorageProperties类: @Data @ConfigurationProperties(prefix = "file") public class FileStorageProperties { private String uploadDi...

9得票2回答
Spring REST安全性:仅在特定端点启用基本身份验证

我已经为我的REST API配置了Spring Security(使用HeaderHttpSessionStrategy)。 我的“WebSecurityConfigurerAdapter”实现如下所示。 @Override protected void configure(Htt...

10得票7回答
如何在Spring MVC REST中调试404资源未找到错误?

我有一个样例的Spring REST MVC应用程序,其中包含以下Java代码: SampleController.javaimport org.apache.logging.log4j.Logger; import org.springframework.beans.factory.ann...

11得票2回答
使用地图来为RestTemplate调用设置参数

我目前正在使用一段代码设置参数,并使用restTemplate对URL进行REST调用,它可以正常工作:MultiValueMap<String, String> map = new LinkedMultiValueMap<String, String>(); map....