@Value(“${}”)注解
使用Springboot项目搭建的项目时,配置文件application.properties或application.yml中的信息可以通过@Value(“${}”)注解获取。
例如:
application.yml文件中
mybatis-plus:
configuration:
schema:MYSQL
其中,MYSQL可以用如下代码获取
@Value("${mybatis-plus.configuration.schema}")
public String schema;