SpringBoot Cloud 分离

master
wangbing 6 years ago
parent 477b707958
commit 473dfffe50

@ -254,7 +254,10 @@ public class ProjectManager {
Callable callback = null; Callable callback = null;
switch (option) { switch (option) {
case "SpringBoot": 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; break;
case "SpringMVC_Mybatis": case "SpringMVC_Mybatis":
// callback = new SpringMVCMybatisCallable(path, dataBase, project, option); // callback = new SpringMVCMybatisCallable(path, dataBase, project, option);

@ -24,14 +24,16 @@ public class SpringBootCallable implements Callable {
private DataBase dataBase; private DataBase dataBase;
private Project project; private Project project;
private String option; private String option;
private boolean cloud;
private FreeMarkerManager freeMarkerManager; 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.root = root;
this.dataBase = dataBase; this.dataBase = dataBase;
this.project = project; this.project = project;
this.option = option; this.option = option;
this.cloud = cloud;
this.freeMarkerManager = ManagerFactory.getFreeMarkerManager(); this.freeMarkerManager = ManagerFactory.getFreeMarkerManager();
} }
@ -162,6 +164,7 @@ public class SpringBootCallable implements Callable {
ctx.put("projectName", project.getProjectName()); ctx.put("projectName", project.getProjectName());
ctx.put("basePackage", project.getProjectBasePackage()); ctx.put("basePackage", project.getProjectBasePackage());
ctx.put("dataBase", dataBase.toString()); ctx.put("dataBase", dataBase.toString());
ctx.put("cloud", cloud);
File file = new File(root.getAbsolutePath(), "pom.xml"); File file = new File(root.getAbsolutePath(), "pom.xml");
@ -522,6 +525,7 @@ public class SpringBootCallable implements Callable {
ctx.put("dBmapper", dBmapper); ctx.put("dBmapper", dBmapper);
ctx.put("date", new Date()); ctx.put("date", new Date());
ctx.put("projectName", project.getProjectName()); 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-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(), "start-prod.bat"), option + "/resources/start-prod.bat", ctx);
freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), "application-dev.properties"), option + "/resources/application-dev.ftl", 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"?> <?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.geometry.*?>
<?import javafx.scene.control.*?> <?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?> <?import javafx.scene.layout.*?>
<BorderPane fx:controller="xyz.wbsite.dbtool.javafx.ctrl.GenerateOptionController" prefHeight="199.0" prefWidth="468.0" <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" <VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="173.0"
prefWidth="468.0"> prefWidth="468.0">
<children> <children>
<Label text="框架"> <Label text="项目">
<padding> <padding>
<Insets bottom="3.0" left="10.0" right="10.0" top="3.0"/> <Insets bottom="3.0" left="10.0" right="10.0" top="3.0"/>
</padding> </padding>
@ -23,7 +21,8 @@
<ToggleGroup fx:id="type"/> <ToggleGroup fx:id="type"/>
</toggleGroup> </toggleGroup>
</RadioButton> </RadioButton>
<!--<RadioButton mnemonicParsing="false" text="SpringMVC_Mybatis" toggleGroup="$type" selected="false"/>--> <RadioButton mnemonicParsing="false" text="SpringBoot+Cloud" toggleGroup="$type"
selected="false"/>
</children> </children>
<padding> <padding>
<Insets bottom="3.0" left="20.0" right="10.0" top="3.0"/> <Insets bottom="3.0" left="20.0" right="10.0" top="3.0"/>

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

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

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

@ -5328,13 +5328,13 @@
<div> <div>
<pre><code> <pre><code>
ajax.example({}).then(function (response) { ajax.example({}).then(function (response) {
if (response.errors.length > 0) { if (response.errors.length > 0) {
nav.e(response.errors[0].message); nav.e(response.errors[0].message);
} else { } else {
nav.i("Ajax调用成功!"); nav.i("Ajax调用成功!");
} }
}) })
</code></pre> </code></pre>
</div> </div>
@ -5367,7 +5367,15 @@
<div> <div>
<pre><code> <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> </code></pre>
</div> </div>

Loading…
Cancel
Save

Powered by TurnKey Linux.