Add halo version to application

pull/146/head
johnniang 2019-05-07 11:15:48 +08:00
parent 8adf79432c
commit 497aaab67f
5 changed files with 20 additions and 7 deletions

View File

@ -8,7 +8,7 @@ apply plugin: 'io.spring.dependency-management'
group = 'run.halo.app'
archivesBaseName = 'halo'
version = '1.0.0'
version = '1.0.0.bata'
sourceCompatibility = '1.8'
description = 'Halo, personal blog system developed in Java.'
@ -27,6 +27,13 @@ configurations {
}
}
bootJar {
manifest {
attributes('Implementation-Title': 'Halo Application',
'Implementation-Version': version)
}
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'

View File

@ -3,6 +3,7 @@ package run.halo.app.config;
import com.fasterxml.classmate.TypeResolver;
import io.swagger.models.auth.In;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;
@ -56,7 +57,7 @@ public class SwaggerConfiguration {
new ResponseMessageBuilder().code(404).message("Not found").build(),
new ResponseMessageBuilder().code(500).message("Internal server error").build());
public SwaggerConfiguration(HaloProperties haloProperties) {
public SwaggerConfiguration( HaloProperties haloProperties) {
this.haloProperties = haloProperties;
}

View File

@ -23,7 +23,7 @@ public class HaloConst {
/**
* version constant
*/
public static final String HALO_VERSION = "1.0.0";
public static final String HALO_VERSION;
/**
* Suffix of freemarker template file
@ -74,4 +74,8 @@ public class HaloConst {
* user_session
*/
public static String USER_SESSION_KEY = "user_session";
static {
HALO_VERSION = HaloConst.class.getPackage().getImplementationVersion();
}
}

View File

@ -57,8 +57,7 @@ public class AdminServiceImpl implements AdminService {
private final StringCacheStore cacheStore;
@Value("${spring.datasource.driver-class-name}")
private String driverClassName;
private final String driverClassName;
public AdminServiceImpl(PostService postService,
SheetService sheetService,
@ -69,7 +68,8 @@ public class AdminServiceImpl implements AdminService {
OptionService optionService,
UserService userService,
LinkService linkService,
StringCacheStore cacheStore) {
StringCacheStore cacheStore,
@Value("${spring.datasource.driver-class-name}") String driverClassName) {
this.postService = postService;
this.sheetService = sheetService;
this.attachmentService = attachmentService;
@ -80,6 +80,7 @@ public class AdminServiceImpl implements AdminService {
this.userService = userService;
this.linkService = linkService;
this.cacheStore = cacheStore;
this.driverClassName = driverClassName;
}
@Override

View File

@ -51,4 +51,4 @@ spring:
logging:
level:
run.halo.app: INFO
file: ./logs/log.log
file: ./logs/log.log