mirror of https://github.com/halo-dev/halo
Remove restart feature (#917)
* Ignore application-local file * Remove restart featurepull/918/head
parent
658f0a2b3f
commit
aee79ef7b4
|
@ -42,19 +42,19 @@ nbdist/
|
|||
*.project
|
||||
*.factorypath
|
||||
|
||||
# Compiled class file
|
||||
### Compiled class file
|
||||
*.class
|
||||
|
||||
# Log file
|
||||
### Log file
|
||||
*.log
|
||||
|
||||
# BlueJ files
|
||||
### BlueJ files
|
||||
*.ctxt
|
||||
|
||||
# Mobile Tools for Java (J2ME)
|
||||
### Mobile Tools for Java (J2ME)
|
||||
.mtj.tmp/
|
||||
|
||||
# Package Files #
|
||||
### Package Files
|
||||
*.war
|
||||
*.nar
|
||||
*.ear
|
||||
|
@ -64,3 +64,8 @@ nbdist/
|
|||
|
||||
### VSCode
|
||||
.vscode
|
||||
|
||||
### Local file
|
||||
application-local.yml
|
||||
application-local.yaml
|
||||
application-local.properties
|
|
@ -1,11 +1,9 @@
|
|||
package run.halo.app;
|
||||
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import run.halo.app.repository.base.BaseRepositoryImpl;
|
||||
|
@ -21,29 +19,12 @@ import run.halo.app.repository.base.BaseRepositoryImpl;
|
|||
@EnableJpaRepositories(basePackages = "run.halo.app.repository", repositoryBaseClass = BaseRepositoryImpl.class)
|
||||
public class Application extends SpringBootServletInitializer {
|
||||
|
||||
private static ConfigurableApplicationContext CONTEXT;
|
||||
|
||||
public static void main(String[] args) {
|
||||
// Customize the spring config location
|
||||
System.setProperty("spring.config.additional-location", "file:${user.home}/.halo/,file:${user.home}/halo-dev/");
|
||||
|
||||
// Run application
|
||||
CONTEXT = SpringApplication.run(Application.class, args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Restart Application.
|
||||
*/
|
||||
public static void restart() {
|
||||
ApplicationArguments args = CONTEXT.getBean(ApplicationArguments.class);
|
||||
|
||||
Thread thread = new Thread(() -> {
|
||||
CONTEXT.close();
|
||||
CONTEXT = SpringApplication.run(Application.class, args.getSourceArgs());
|
||||
});
|
||||
|
||||
thread.setDaemon(false);
|
||||
thread.start();
|
||||
SpringApplication.run(Application.class, args);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -4,9 +4,9 @@ import io.swagger.annotations.ApiOperation;
|
|||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import run.halo.app.Application;
|
||||
import run.halo.app.annotation.DisableOnCondition;
|
||||
import run.halo.app.cache.lock.CacheLock;
|
||||
import run.halo.app.exception.BadRequestException;
|
||||
import run.halo.app.model.dto.EnvironmentDTO;
|
||||
import run.halo.app.model.dto.LoginPreCheckDTO;
|
||||
import run.halo.app.model.dto.StatisticDTO;
|
||||
|
@ -131,8 +131,9 @@ public class AdminController {
|
|||
@PostMapping(value = {"halo/restart", "spring/restart"})
|
||||
@ApiOperation("Restarts halo server")
|
||||
@DisableOnCondition
|
||||
@Deprecated
|
||||
public void restartApplication() {
|
||||
Application.restart();
|
||||
throw new BadRequestException("此前的重启方案存在性能问题,故暂不支持重启功能!");
|
||||
}
|
||||
|
||||
@GetMapping(value = "halo/logfile")
|
||||
|
|
Loading…
Reference in New Issue