Advertisement

config variables/config arrays/compare config files/multi-environment config/server notes

阅读量:
  • 配置参数

展示错误操作:

  1. 在application.yml文件中

spring:
datasource:
url: jdbc:mysql://localhost:3306/t311
username: root
password: root
driver-class-name: com.mysql.cj.jdbc.Driver
type: com.alibaba.druid.pool.DruidDataSource
mybatis-plus:
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
map-underscore-to-camel-case: false __#__采用驼峰命名方式

__#__设置参数
username: 罗学敏

  1. 在controller层

@RestController
public class TestController {

@Value("${username}")
private String userName;

@GetMapping("getUN")
public String get

全部评论 (0)

还没有任何评论哟~