SPRING BOOT共16篇
已解决:SpringBoot使用Swagger2提示Unable to infer base url错误-Ddmit

已解决: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...
ddmit的头像-DdmitDdmit6年前
02.7W+35
Spring Boot获取yml文件配置注入Map/List/String等类型-Ddmit

Spring Boot获取yml文件配置注入Map/List/String等类型

在Java类中,如何获取application.yml的配置内容呢?具体实现如下: 前提 用到的yml文件有application.yml、application-access-dev.yml、application-access-devSjzd.yml,其中application.yml...
ddmit的头像-DdmitDdmit4年前
031990
Spring Cloud Feign如何获得接口返回的文件流-Ddmit

Spring Cloud Feign如何获得接口返回的文件流

本文通过Feign实现微服务间接口调用,返回stream,从而让通过stream实现文件的下载、页面图片、视频等展示成为可能,实现代码如下。 服务端 Controller @GetMapping(value = '/fileStream/{file...
ddmit的头像-DdmitDdmit5年前
30400
lombok配置文件说明-Ddmit

lombok配置文件说明

lombok.config文件配置项说明: # 默认: false,lombok默认对boolean类型字段生成的get方法使用is前缀, 通过此配置则使用get前缀 lombok.getter.noIsPrefix=true # 默认: false,默认的set方法...
ddmit的头像-DdmitDdmit6年前
027221
Spring Boot常用注解-Ddmit

Spring Boot常用注解

1.@SpringBootApplication @SpringBootApplication注解等价于以默认属性使用@Configuration, @EnableAutoConfiguration 和 @ComponentScan 。 官方文档:Using the @SpringBootApplication Ann...
ddmit的头像-DdmitDdmit6年前
025320
Spring判断当前连接的数据库类型-Ddmit

Spring判断当前连接的数据库类型

Java代码获取当前连接的数据库类型,这里使用org.springframework.jdbc.core.JdbcTemplate类。 依赖: <dependency> <groupId>org.springframework.boot</groupId> <artif...
ddmit的头像-DdmitDdmit5年前
024100
Spring注解@Controller和@RestController的区别?-Ddmit

Spring注解@Controller和@RestController的区别?

官方文档:Annotation Type RestController 解释说:A convenience annotation that is itself annotated with @Controller and @ResponseBody。 也就是@RestController注解相当于控制器前加@Co...
ddmit的头像-DdmitDdmit6年前
022781
IntelliJ IDEA配置实现SpringBoot项目热部署的最简单方式-Ddmit

IntelliJ IDEA配置实现SpringBoot项目热部署的最简单方式

这里整理了几种IntelliJ IDEA配置实现SpringBoot项目热部署的方式,其中使用jrebel应该是最简单的方式,而且没有后遗症: 环境: IntelliJ IDEA 2018.3; Jrebel 2018.1.7; 方式一 1.安装jrebe...
ddmit的头像-DdmitDdmit6年前
022650
Springboot提示No beans of 'RestTemplate' type found错误-Ddmit

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...
ddmit的头像-DdmitDdmit4年前
021060
Spring Boot如何获取HTTP请求头-Ddmit

Spring Boot如何获取HTTP请求头

获取单个Header 示例: @PostMapping(value = '/tree') public String organTree(@RequestHeader('appKey') String appKey) { return ''; } 获取所有Header 示例: @GetMapping('/listHeaders')...
ddmit的头像-DdmitDdmit5年前
020390