SpringBoot Cloud 分离

master
wangbing 6 years ago
parent 477b707958
commit 473dfffe50

@ -254,7 +254,10 @@ public class ProjectManager {
Callable callback = null;
switch (option) {
case "SpringBoot":
callback = new SpringBootCallable(path, dataBase, project, option);
callback = new SpringBootCallable(path, dataBase, project, option, false);
break;
case "SpringBoot+Cloud":
callback = new SpringBootCallable(path, dataBase, project, "SpringBoot", true);
break;
case "SpringMVC_Mybatis":
// callback = new SpringMVCMybatisCallable(path, dataBase, project, option);

@ -24,14 +24,16 @@ public class SpringBootCallable implements Callable {
private DataBase dataBase;
private Project project;
private String option;
private boolean cloud;
private FreeMarkerManager freeMarkerManager;
public SpringBootCallable(String root, DataBase dataBase, Project project, String option) {
public SpringBootCallable(String root, DataBase dataBase, Project project, String option,boolean cloud) {
this.root = root;
this.dataBase = dataBase;
this.project = project;
this.option = option;
this.cloud = cloud;
this.freeMarkerManager = ManagerFactory.getFreeMarkerManager();
}
@ -162,6 +164,7 @@ public class SpringBootCallable implements Callable {
ctx.put("projectName", project.getProjectName());
ctx.put("basePackage", project.getProjectBasePackage());
ctx.put("dataBase", dataBase.toString());
ctx.put("cloud", cloud);
File file = new File(root.getAbsolutePath(), "pom.xml");
@ -522,6 +525,7 @@ public class SpringBootCallable implements Callable {
ctx.put("dBmapper", dBmapper);
ctx.put("date", new Date());
ctx.put("projectName", project.getProjectName());
ctx.put("cloud", cloud);
freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), "start-dev.bat"), option + "/resources/start-dev.bat", ctx);
freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), "start-prod.bat"), option + "/resources/start-prod.bat", ctx);
freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), "application-dev.properties"), option + "/resources/application-dev.ftl", ctx);

@ -1,7 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.*?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<BorderPane fx:controller="xyz.wbsite.dbtool.javafx.ctrl.GenerateOptionController" prefHeight="199.0" prefWidth="468.0"
@ -10,7 +8,7 @@
<VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="173.0"
prefWidth="468.0">
<children>
<Label text="框架">
<Label text="项目">
<padding>
<Insets bottom="3.0" left="10.0" right="10.0" top="3.0"/>
</padding>
@ -23,7 +21,8 @@
<ToggleGroup fx:id="type"/>
</toggleGroup>
</RadioButton>
<!--<RadioButton mnemonicParsing="false" text="SpringMVC_Mybatis" toggleGroup="$type" selected="false"/>-->
<RadioButton mnemonicParsing="false" text="SpringBoot+Cloud" toggleGroup="$type"
selected="false"/>
</children>
<padding>
<Insets bottom="3.0" left="20.0" right="10.0" top="3.0"/>

@ -56,6 +56,7 @@
<artifactId>spring-boot-starter-freemarker</artifactId>
</dependency>
<#if cloud>
<!-- eureka-client -->
<dependency>
<groupId>org.springframework.cloud</groupId>
@ -71,6 +72,7 @@
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
</#if>
<dependency>
<groupId>org.springframework.boot</groupId>

@ -4,7 +4,9 @@ server.servlet.context-path=/
spring.mvc.static-path-pattern=/static/**
spring.resources.static-locations=classpath:static/
spring.application.name=${projectName}
<#if cloud>
eureka.client.serviceUrl.defaultZone=http://localhost:18080/eureka/
</#if>
# 编码配置
spring.http.encoding.force=true
spring.http.encoding.charset=UTF-8

@ -5,7 +5,9 @@ spring.mvc.static-path-pattern=/static/**
spring.resources.static-locations=classpath:static/
spring.application.name=${projectName}
spring.main.banner-mode=off
<#if cloud>
eureka.client.serviceUrl.defaultZone=http://localhost:18080/eureka/
</#if>
# 编码配置
spring.http.encoding.force=true
spring.http.encoding.charset=UTF-8

@ -5367,7 +5367,15 @@
<div>
<pre><code>
ajax.fileUpload(req.file).then(function (response) {
if (response.errors.length > 0) {
req.onError();
nav.e(response.errors[0].message);
} else {
req.onSuccess();
nav.i("文件上传成功!");
}
})
</code></pre>
</div>

Loading…
Cancel
Save

Powered by TurnKey Linux.