我正在使用弹簧靴1.3.5和弹簧4.2.6,并且不确定弹簧靴是否正在运行。日志中没有错误,即使尝试也无法看到spring boot横幅:
SpringApplication app = new SpringApplication(App.class);
app.setBannerMode(Banner.Mode.LOG);
app.run(args);
或
app.setBannerMode(Banner.Mode.CONSOLE);
此外,我无法从application.yml中读取配置文件属性
这让我想知道springboot是否真的在运行。有没有办法确认?
application.yml: 弹簧: 个人资料: 主动:“ dev”
---
spring:
profiles: dev
server:
cluster:
- ip: 127.0.0.1
path: /dev1
- ip: 127.0.0.2
path: /dev2
- ip: 127.0.0.3
path: /dev3
ServerProperties.java
@Component
@ConfigurationProperties("server")
public class ServerProperties {
private List<Cluster> cluster = new ArrayList<>();
public static class Cluster {
private String ip;
private String path;
public String getIp() {
return ip;
}
public void setIp(String ip) {
this.ip = ip;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
@Override
public String toString() {
return "Cluster{" +
"ip='" + ip + '\'' +
", path='" + path + '\'' +
'}';
}
}
public List<Cluster> getCluster() {
return cluster;
}
public void setCluster(List<Cluster> cluster) {
this.cluster = cluster;
}
@Override
public String toString() {
return "ServerProperties{" +
"cluster=" + cluster +
'}';
}
}
任何见识都受到赞赏!