排序
Spring BOOT三步入门
三步开始一个Spring Boot项目: 1.官网生成框架代码 访问 https://start.spring.io/,添加自己需要的依赖,这里添加web依赖,如下图: 2.新建一个RestController 使用IDEA,File->Open打开解...
Springboot提示No beans of ‘RestTemplate’ type found错误
错误信息 在使用RestTemplate时,IntelliJ Idea提示Could not autowire. No beans of 'RestTemplate' type found.。 代码清单: @Component public class SmsUtil { @Autowired private RestTem...
已解决:SpringBoot使用Swagger2提示Unable to infer base url错误
环境 版本: swagger2 2.9.2; 错误信息 访问swagger首页 http://localhost:8080/swagger-ui.html,错误信息如下: Unable to infer base url. This is common when using dynamic servlet regi...
@Component使用@Autowired注入失败报空指针异常
在使用@Component注解的工具类中,注入RestTemplate和读取nacos配置@Value注解读取失败。解决办法是使用@PostConstruct注解进行初始化。 @Component public class SmsUtil { private static Sms...
lombok配置文件说明
lombok.config文件配置项说明: # 默认: false,lombok默认对boolean类型字段生成的get方法使用is前缀, 通过此配置则使用get前缀 lombok.getter.noIsPrefix=true # 默认: false,默认的set方法...
Spring Cloud Feign如何获得接口返回的文件流
本文通过Feign实现微服务间接口调用,返回stream,从而让通过stream实现文件的下载、页面图片、视频等展示成为可能,实现代码如下。 服务端 Controller @GetMapping(value = '/fileStream/{file...
Spring Boot获取yml文件配置注入Map/List/String等类型
在Java类中,如何获取application.yml的配置内容呢?具体实现如下: 前提 用到的yml文件有application.yml、application-access-dev.yml、application-access-devSjzd.yml,其中application.yml...
Spring Boot注解@PostConstruct含义
Spring Boot项目中使用@PostConstruct注解的作用是什么呢? 参考: 注解@PostConstruct与@PreDestroy详解及实例 @PostConstruct Why use @PostConstruct?
Spring Boot如何获取HTTP请求头
获取单个Header 示例: @PostMapping(value = '/tree') public String organTree(@RequestHeader('appKey') String appKey) { return ''; } 获取所有Header 示例: @GetMapping('/listHeaders')...
Spring Boot读取jar包文件错误解决
从jar包中读取classpath下文件出错: java.io.FileNotFoundException: class path resource [conf/sendofd.xml] cannot be resolved to absolute file path because it does not reside in the ...


