Skip to content

Commit

Permalink
增加jar包启动命令
Browse files Browse the repository at this point in the history
  • Loading branch information
atjiu committed Mar 17, 2017
1 parent 02143e1 commit 3fa89ee
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 5 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@
</properties>

<dependencies>
<!--<dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>-->
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
Expand Down
26 changes: 26 additions & 0 deletions src/main/java/cn/tomoya/PybbsApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,32 @@ public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception
}

public static void main(String[] args) {
for(String s : args) {
String[] _ss = s.split("=");
if(_ss[0].equals("port")) {
System.setProperty("server.port", _ss[1]);
} else if(_ss[0].equals("cache")) {
System.setProperty("spring.freemarker.cache", _ss[1]);
} else if(_ss[0].equals("password")) {
System.setProperty("spring.datasource.password", _ss[1]);
} else if(_ss[0].equals("showSql")) {
System.setProperty("spring.jpa.show-sql", _ss[1]);
} else if(_ss[0].equals("name")) {
System.setProperty("site.name", _ss[1]);
} else if(_ss[0].equals("intro")) {
System.setProperty("site.intro", _ss[1]);
} else if(_ss[0].equals("baseUrl")) {
System.setProperty("site.baseUrl", _ss[1]);
} else if(_ss[0].equals("staticUrl")) {
System.setProperty("site.staticUrl", _ss[1]);
} else if(_ss[0].equals("pageSize")) {
System.setProperty("site.pageSize", _ss[1]);
} else if(_ss[0].equals("uploadPath")) {
System.setProperty("site.uploadPath", _ss[1]);
} else if(_ss[0].equals("editor")) {
System.setProperty("site.editor", _ss[1]);
}
}
SpringApplication.run(PybbsApplication.class, args);
}
}
4 changes: 2 additions & 2 deletions src/main/java/cn/tomoya/util/FileUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ public String uploadFile(MultipartFile file, FileUploadEnum fileUploadEnum) thro
String requestPath = null;
if (fileUploadEnum == FileUploadEnum.FILE) {
stream = new BufferedOutputStream(new FileOutputStream(new File(siteConfig.getUploadPath() + fileName)));
requestPath = siteConfig.getStaticUrl() + "static/images/upload/";
requestPath = siteConfig.getStaticUrl();
} else if (fileUploadEnum == FileUploadEnum.AVATAR) {
stream = new BufferedOutputStream(new FileOutputStream(new File(siteConfig.getUploadPath() + "avatar/" + fileName)));
requestPath = siteConfig.getStaticUrl() + "static/images/upload/avatar/";
requestPath = siteConfig.getStaticUrl() + "avatar/";
}
if (stream != null) {
stream.write(file.getBytes());
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ spring:
datasource:
url: jdbc:mysql://localhost/pybbs-springboot?useSSL=false&characterEncoding=utf8
username: root
password:
password: 123123
jpa:
database: mysql
show-sql: true
Expand Down

0 comments on commit 3fa89ee

Please sign in to comment.