下面列出了org.springframework.boot.SpringBootVersion#getVersion ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@Override
public void printBanner(Environment environment, Class<?> sourceClass,
PrintStream printStream) {
for (String line : BANNER) {
printStream.println(line);
}
String version = SpringBootVersion.getVersion();
version = (version == null ? "" : " (v" + version + ")");
String padding = "";
while (padding.length() < STRAP_LINE_SIZE
- (version.length() + SPRING_BOOT.length())) {
padding += " ";
}
printStream.println(AnsiOutput.toString(AnsiColor.GREEN, SPRING_BOOT,
AnsiColor.DEFAULT, padding, AnsiStyle.FAINT, version));
printStream.println();
}
protected String getLiquibaseProperty() {
String springBootVersion = SpringBootVersion.getVersion();
if (springBootVersion == null || !springBootVersion.startsWith("1")) {
return "spring.liquibase.enabled";
} else {
return "liquibase.enabled";
}
}
@Test
public void verifierPropertiesContainsCurrentBootVersion() {
String version = SpringBootVersion.getVersion();
assertThat(version).isNotBlank();
for (String compatibleVersion : verifierProperties.getCompatibleBootVersions()) {
if (version.startsWith(stripWildCardFromVersion(compatibleVersion))) {
// success we found the current boot version in our list of compatible
// versions.
return;
}
}
fail(version + " not found in " + verifierProperties.getCompatibleBootVersions());
}
@Bean
public SimpleInfoContributor springBootVersionInfoContributor() {
return new SimpleInfoContributor("spring-boot-version", SpringBootVersion.getVersion());
}
@Override
public String getVersion() {
return "1.0 on Spring Boot " + SpringBootVersion.getVersion();
}
String getVersionFromManifest() {
return SpringBootVersion.getVersion();
}