Skip to content

Commit

Permalink
Support war package.
Browse files Browse the repository at this point in the history
  • Loading branch information
ruibaby committed Jun 5, 2019
1 parent 5149c3d commit 109c2e0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ plugins {
id 'org.springframework.boot' version '2.1.3.RELEASE'
id "io.freefair.lombok" version "3.1.4"
id 'java'
id 'war'
}

apply plugin: 'io.spring.dependency-management'
Expand Down
10 changes: 9 additions & 1 deletion src/main/java/run/halo/app/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

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.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.scheduling.annotation.EnableAsync;
Expand All @@ -21,7 +23,7 @@
@EnableScheduling
@EnableAsync
@EnableJpaRepositories(basePackages = "run.halo.app.repository", repositoryBaseClass = BaseRepositoryImpl.class)
public class Application {
public class Application extends SpringBootServletInitializer {

public static void main(String[] args) {
// Customize the spring config location
Expand All @@ -30,4 +32,10 @@ public static void main(String[] args) {
// Run application
SpringApplication.run(Application.class, args);
}

@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
System.setProperty("spring.config.additional-location", "file:${user.home}/.halo/,file:${user.home}/halo-dev/");
return application.sources(Application.class);
}
}

0 comments on commit 109c2e0

Please sign in to comment.