SpringBoot小知识

SpringBoot入门配置

SpringBoot配置
Application.yml
Server:
	Port:9090
url:https://www.baidu.com
person:
	name:jack
	age:20

SpringBoot静态资源处理

静态资源放在resources下的static或者public目录下(没有可以创建)

Spring Boot集成试单元测试 Test

// 添加依赖
// 编写单元测试类()
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes={启动类.class})

springboot指定配置文件启动

spring.profiles.active

SpringBoot集成MyBatis

  1. 添加依赖
  2. 配置文件中配置
    #连接池的配置
spring:
	datasource:
		driver-class-name: com.mysql.jdbc.Driver
		url: jdbc:mysql://localhost:3306/springboot?characterEncoding=utf-8
		username: root
		password: root
	#mybatis配置mapper.xml文件位置以及包扫描
	mybatis:
		mapper-locations: classpath*:mapper/*.xml #mapper文件扫描
		type-aliases-package: com.springboot.domain #别名扫描
  1. 编写 mapper 接口(使用@Mapper注解,相当于MapperScan包扫描)
  2. 编写 mapper.xml文件

常用注解解析前端参数

// 接收字符串集合
@RequestParam("ids[]") List<String> ids
data: {"ids": ids}

// 接收对象集合
@RequestBody Hazard[] list
data: JSON.stringify(data),
contentType: 'application/json',

URLDecoder.decode(userName, "UTF-8")
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值