排序
已解决: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...
Spring Boot获取yml文件配置注入Map/List/String等类型
在Java类中,如何获取application.yml的配置内容呢?具体实现如下: 前提 用到的yml文件有application.yml、application-access-dev.yml、application-access-devSjzd.yml,其中application.yml...
Spring Cloud Feign如何获得接口返回的文件流
本文通过Feign实现微服务间接口调用,返回stream,从而让通过stream实现文件的下载、页面图片、视频等展示成为可能,实现代码如下。 服务端 Controller @GetMapping(value = '/fileStream/{file...
lombok配置文件说明
lombok.config文件配置项说明: # 默认: false,lombok默认对boolean类型字段生成的get方法使用is前缀, 通过此配置则使用get前缀 lombok.getter.noIsPrefix=true # 默认: false,默认的set方法...
Spring Boot常用注解
1.@SpringBootApplication @SpringBootApplication注解等价于以默认属性使用@Configuration, @EnableAutoConfiguration 和 @ComponentScan 。 官方文档:Using the @SpringBootApplication Ann...
Spring判断当前连接的数据库类型
Java代码获取当前连接的数据库类型,这里使用org.springframework.jdbc.core.JdbcTemplate类。 依赖: <dependency> <groupId>org.springframework.boot</groupId> <artif...
Spring注解@Controller和@RestController的区别?
官方文档:Annotation Type RestController 解释说:A convenience annotation that is itself annotated with @Controller and @ResponseBody。 也就是@RestController注解相当于控制器前加@Co...
IntelliJ IDEA配置实现SpringBoot项目热部署的最简单方式
这里整理了几种IntelliJ IDEA配置实现SpringBoot项目热部署的方式,其中使用jrebel应该是最简单的方式,而且没有后遗症: 环境: IntelliJ IDEA 2018.3; Jrebel 2018.1.7; 方式一 1.安装jrebe...
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...
Spring Boot如何获取HTTP请求头
获取单个Header 示例: @PostMapping(value = '/tree') public String organTree(@RequestHeader('appKey') String appKey) { return ''; } 获取所有Header 示例: @GetMapping('/listHeaders')...