leo*_*leo 3 spring annotations
我想创建@Bean ExampleProperties.java 并且想在application.yaml 中自动获取key/value,例如:
@ConfigurationProperties("server")
public class ExampleProperties {
private String context-path; //this would be a mistake, cause you could not have "-" in parameter name,
}
Run Code Online (Sandbox Code Playgroud)
如何在application.yml中创建一个等于key的参数??
根据带有破折号的Spring 文档属性将在 java 中表示为
@ConfigurationProperties("server")
public class ExampleProperties {
private String contextPath;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6005 次 |
| 最近记录: |