#init commit
This commit is contained in:
@@ -0,0 +1,24 @@
|
|||||||
|
package {{ .package }}.common.response;public class FailData {
|
||||||
|
private int code = 500;
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
public FailData() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCode() {
|
||||||
|
return this.code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCode(int code) {
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMessage() {
|
||||||
|
return this.message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMessage(String message) {
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,15 +1,19 @@
|
|||||||
package {{ .package }}.common.response;
|
package {{ .package }}.common.response;
|
||||||
|
|
||||||
import java.text.*;
|
import java.text.*;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
public class MyDateFormat extends DateFormat {
|
public class MyDateFormat extends DateFormat {
|
||||||
private static final long serialVersionUID = -4580955831439573829L;
|
private static final long serialVersionUID = -4580955831439573829L;
|
||||||
private static final String customDateFormat = "yyyy-MM-dd HH:mm:ss";
|
|
||||||
private DateFormat dateFormat;
|
private DateFormat dateFormat;
|
||||||
private SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
private SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
|
||||||
|
public MyDateFormat() {
|
||||||
|
this.calendar = Calendar.getInstance();
|
||||||
|
this.dateFormat = simpleDateFormat;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public MyDateFormat(DateFormat dateFormat) {
|
public MyDateFormat(DateFormat dateFormat) {
|
||||||
this.calendar = Calendar.getInstance();
|
this.calendar = Calendar.getInstance();
|
||||||
this.dateFormat = dateFormat;
|
this.dateFormat = dateFormat;
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package {{ .package }}.common.response;
|
||||||
|
import com.fasterxml.jackson.core.JsonParser.Feature;
|
||||||
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||||
|
import com.fasterxml.jackson.databind.module.SimpleModule;
|
||||||
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
public class ObjectMapperFactory {
|
||||||
|
private static final ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
|
||||||
|
public ObjectMapperFactory() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ObjectMapper getDefaultObjectMapper() {
|
||||||
|
return objectMapper.copy();
|
||||||
|
}
|
||||||
|
|
||||||
|
static {
|
||||||
|
objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES).disable(SerializationFeature.FAIL_ON_EMPTY_BEANS).disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS).configure(Feature.ALLOW_SINGLE_QUOTES, true);
|
||||||
|
SimpleModule bigDecimalModule = new SimpleModule();
|
||||||
|
bigDecimalModule.addSerializer(BigDecimal.class, new ToStringSerializer());
|
||||||
|
objectMapper.registerModule(bigDecimalModule);
|
||||||
|
objectMapper.setDateFormat(new MyDateFormat());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,18 +1,11 @@
|
|||||||
package {{ .package }}.common.response;
|
package {{ .package }}.common.response;
|
||||||
|
import com.vs.ex.BizException;
|
||||||
import com.vs.common.util.rpc.pub.FailData;
|
|
||||||
import com.vs.ox.common.exception.ErrorCode;
|
|
||||||
import com.vs.ox.common.exception.IgnoredException;
|
|
||||||
import com.vs.ox.common.utils.ObjectMapperFactory;
|
|
||||||
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import jakarta.validation.ConstraintViolation;
|
import jakarta.validation.ConstraintViolation;
|
||||||
import jakarta.validation.ConstraintViolationException;
|
import jakarta.validation.ConstraintViolationException;
|
||||||
import jakarta.validation.Path;
|
import jakarta.validation.Path;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.InitializingBean;
|
import org.springframework.beans.factory.InitializingBean;
|
||||||
import org.springframework.core.Ordered;
|
import org.springframework.core.Ordered;
|
||||||
@@ -24,65 +17,42 @@ import org.springframework.web.servlet.ModelAndView;
|
|||||||
import org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver;
|
import org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.PrintWriter;
|
|
||||||
import java.io.StringWriter;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class ResponseJsonExceptionResolver extends AbstractHandlerExceptionResolver
|
public class ResponseJsonExceptionResolver extends AbstractHandlerExceptionResolver implements InitializingBean {
|
||||||
implements InitializingBean {
|
|
||||||
private HttpMessageConverter messageConverter;
|
private HttpMessageConverter messageConverter;
|
||||||
|
|
||||||
public ResponseJsonExceptionResolver() {}
|
public ResponseJsonExceptionResolver() {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterPropertiesSet() throws Exception {
|
public void afterPropertiesSet() throws Exception {
|
||||||
if (messageConverter == null) {
|
if (messageConverter == null) {
|
||||||
messageConverter =
|
messageConverter = new MappingJackson2HttpMessageConverter(ObjectMapperFactory.getDefaultObjectMapper());
|
||||||
new MappingJackson2HttpMessageConverter(
|
|
||||||
ObjectMapperFactory.getDefaultObjectMapper());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getErrorInfoFromException(Exception e) {
|
|
||||||
try {
|
|
||||||
StringWriter sw = new StringWriter();
|
|
||||||
PrintWriter pw = new PrintWriter(sw);
|
|
||||||
e.printStackTrace(pw);
|
|
||||||
return "\r\n" + sw.toString() + "\r\n";
|
|
||||||
} catch (Exception e2) {
|
|
||||||
return "bad getErrorInfoFromException";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ModelAndView doResolveException(
|
protected ModelAndView doResolveException(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) {
|
||||||
HttpServletRequest request,
|
|
||||||
HttpServletResponse response,
|
|
||||||
Object handler,
|
|
||||||
Exception ex) {
|
|
||||||
/** web请求分页单独处理,应对antd框架 */
|
|
||||||
FailData failData = new FailData();
|
FailData failData = new FailData();
|
||||||
failData.setMessage(ex.getMessage());
|
failData.setMessage(ex.getMessage());
|
||||||
if (ex instanceof IgnoredException) {
|
if (ex instanceof BizException) {
|
||||||
IgnoredException realEx = (IgnoredException) ex;
|
BizException realEx = (BizException) ex;
|
||||||
failData.setCode(realEx.getErrorCode());
|
failData.setCode(realEx.getCode());
|
||||||
failData.setData(realEx.getData());
|
failData.setMessage(realEx.getMessage());
|
||||||
log.error("execute {} failed with exception", request.getRequestURL(), ex);
|
log.error("execute {} failed with exception", request.getRequestURL(), ex);
|
||||||
} else if (ex instanceof ConstraintViolationException) {
|
} else if (ex instanceof ConstraintViolationException) {
|
||||||
failData.setCode(ErrorCode.WRONG_PARAMETER);
|
failData.setCode(400);
|
||||||
failData.setMessage(getMessage((ConstraintViolationException) ex));
|
failData.setMessage(getMessage((ConstraintViolationException) ex));
|
||||||
} else if (ex instanceof ErrorCode) {
|
|
||||||
failData.setCode(((ErrorCode) ex).getErrorCode());
|
|
||||||
} else {
|
} else {
|
||||||
log.error("execute {} failed with exception", request.getRequestURL(), ex);
|
log.error("execute {} failed with exception", request.getRequestURL(), ex);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
response.setCharacterEncoding("utf-8");
|
response.setCharacterEncoding("utf-8");
|
||||||
messageConverter.write(
|
messageConverter.write(failData, MediaType.APPLICATION_JSON, new ServletServerHttpResponse(response));
|
||||||
failData, MediaType.APPLICATION_JSON, new ServletServerHttpResponse(response));
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.error(e.getMessage(), e);
|
logger.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
@@ -99,9 +69,7 @@ public class ResponseJsonExceptionResolver extends AbstractHandlerExceptionResol
|
|||||||
for (ConstraintViolation<?> constraintViolation : e.getConstraintViolations()) {
|
for (ConstraintViolation<?> constraintViolation : e.getConstraintViolations()) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
StringBuilder param = new StringBuilder();
|
StringBuilder param = new StringBuilder();
|
||||||
for (Iterator<Path.Node> iterator = constraintViolation.getPropertyPath().iterator();
|
for (Iterator<Path.Node> iterator = constraintViolation.getPropertyPath().iterator(); iterator.hasNext(); i++) {
|
||||||
iterator.hasNext();
|
|
||||||
i++) {
|
|
||||||
Path.Node node = iterator.next();
|
Path.Node node = iterator.next();
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
continue;
|
continue;
|
||||||
@@ -111,8 +79,9 @@ public class ResponseJsonExceptionResolver extends AbstractHandlerExceptionResol
|
|||||||
}
|
}
|
||||||
param.append(node.getName());
|
param.append(node.getName());
|
||||||
}
|
}
|
||||||
msgList.add("参数 [ " + param + " ] " + constraintViolation.getMessage());
|
msgList.add("Param [ " + param + " ] " + constraintViolation.getMessage());
|
||||||
}
|
}
|
||||||
return StringUtils.join(msgList.toArray(), ";");
|
return StringUtils.join(msgList.toArray(), ";");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
package {{ .package }}.common.response;
|
package {{ .package }}.common.response;
|
||||||
|
|
||||||
import com.vs.common.util.rpc.pub.SuccessData;
|
|
||||||
import com.vs.ox.common.utils.ObjectMapperFactory;
|
|
||||||
|
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.springframework.beans.factory.InitializingBean;
|
import org.springframework.beans.factory.InitializingBean;
|
||||||
@@ -25,9 +22,7 @@ public class ResponseJsonMethodReturnValueHandler
|
|||||||
@Override
|
@Override
|
||||||
public void afterPropertiesSet() {
|
public void afterPropertiesSet() {
|
||||||
if (messageConverter == null) {
|
if (messageConverter == null) {
|
||||||
messageConverter =
|
messageConverter = new MappingJackson2HttpMessageConverter(ObjectMapperFactory.getDefaultObjectMapper());
|
||||||
new MappingJackson2HttpMessageConverter(
|
|
||||||
ObjectMapperFactory.getDefaultObjectMapper());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,26 +32,17 @@ public class ResponseJsonMethodReturnValueHandler
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleReturnValue(
|
public void handleReturnValue(Object returnValue, MethodParameter returnType, ModelAndViewContainer mavContainer, NativeWebRequest webRequest) throws Exception {
|
||||||
Object returnValue,
|
try {
|
||||||
MethodParameter returnType,
|
mavContainer.setRequestHandled(true);
|
||||||
ModelAndViewContainer mavContainer,
|
String customMessage = ResponseMessageHolder.getMessage();
|
||||||
NativeWebRequest webRequest)
|
int code = ResponseMessageHolder.getCode();
|
||||||
throws Exception {
|
Object result = new SuccessData(code, returnValue, customMessage);
|
||||||
mavContainer.setRequestHandled(true);
|
|
||||||
Object result = returnValue;
|
ServletServerHttpResponse response = new ServletServerHttpResponse(webRequest.getNativeResponse(HttpServletResponse.class));
|
||||||
/** Web分页请求的返回按照antd框架要求的格式,不转为SuccessData */
|
messageConverter.write(result, new MediaType(MediaType.APPLICATION_JSON, Collections.singletonMap("charset", "utf-8")), response);
|
||||||
result =
|
} finally {
|
||||||
result == null
|
ResponseMessageHolder.clear();
|
||||||
? new SuccessData(Collections.emptyMap())
|
}
|
||||||
: new SuccessData(returnValue);
|
|
||||||
ServletServerHttpResponse response =
|
|
||||||
new ServletServerHttpResponse(
|
|
||||||
webRequest.getNativeResponse(HttpServletResponse.class));
|
|
||||||
messageConverter.write(
|
|
||||||
result,
|
|
||||||
new MediaType(
|
|
||||||
MediaType.APPLICATION_JSON, Collections.singletonMap("charset", "utf-8")),
|
|
||||||
response);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package {{ .package }}.common.response;
|
||||||
|
public class ResponseMessageHolder {
|
||||||
|
private static final ThreadLocal<String> MESSAGE_HOLDER = new InheritableThreadLocal<>();
|
||||||
|
|
||||||
|
public static void setMessage(String message) {
|
||||||
|
MESSAGE_HOLDER.set(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getMessage() {
|
||||||
|
return MESSAGE_HOLDER.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void clear() {
|
||||||
|
MESSAGE_HOLDER.remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final ThreadLocal<Integer> CODE_HOLDER = new InheritableThreadLocal<>();
|
||||||
|
|
||||||
|
public static void setCode(Integer code) {
|
||||||
|
CODE_HOLDER.set(code);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Integer getCode() {
|
||||||
|
Integer code = CODE_HOLDER.get();
|
||||||
|
return code == null ? 200 : code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void clearCode() {
|
||||||
|
CODE_HOLDER.remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setCodeAndMessage(Integer code, String message) {
|
||||||
|
setCode(code);
|
||||||
|
setMessage(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void clearAll() {
|
||||||
|
MESSAGE_HOLDER.remove();
|
||||||
|
CODE_HOLDER.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
package {{ .package }}.common.response;
|
||||||
|
public class SuccessData {
|
||||||
|
private int code = 200;
|
||||||
|
private Object data;
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
public SuccessData() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public SuccessData(Object data){
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SuccessData(int code, Object data) {
|
||||||
|
this.code = code;
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SuccessData(int code, Object data, String message) {
|
||||||
|
this.code = code;
|
||||||
|
this.data = data;
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCode(int code) {
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getData() {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setData(Object data) {
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMessage() {
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMessage(String message) {
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
package {{ .package }}.common.response;
|
package {{ .package }}.common.response;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
|
||||||
import org.springframework.beans.BeansException;
|
import org.springframework.beans.BeansException;
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
package {{ .package }}.entrance.web;
|
package {{ .package }}.entrance.web;
|
||||||
|
|
||||||
import com.vs.sqlmapper.spring.DataSourceConfig;
|
|
||||||
import com.vs.sqlmapper.spring.scan.VSDaoBeanScan;
|
|
||||||
import com.vs.agent.TocoAgentInitializer;
|
|
||||||
|
|
||||||
import org.mybatis.spring.annotation.MapperScan;
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
@@ -13,8 +9,6 @@ import org.springframework.scheduling.annotation.EnableScheduling;
|
|||||||
|
|
||||||
|
|
||||||
@SpringBootApplication(scanBasePackages = {"{{.groupId}}", "com.vs"})
|
@SpringBootApplication(scanBasePackages = {"{{.groupId}}", "com.vs"})
|
||||||
@VSDaoBeanScan(basePackages = {"com.vs","{{.groupId}}"})
|
|
||||||
@Import(DataSourceConfig.class)
|
|
||||||
@MapperScan("{{.groupId}}.**.persist.mapper.mybatis")
|
@MapperScan("{{.groupId}}.**.persist.mapper.mybatis")
|
||||||
@EnableScheduling
|
@EnableScheduling
|
||||||
public class AppApplication{
|
public class AppApplication{
|
||||||
|
|||||||
@@ -1,15 +1,13 @@
|
|||||||
server.port=8082
|
server.port=8082
|
||||||
|
|
||||||
mock.enabled=true
|
|
||||||
#datasource
|
#datasource
|
||||||
{{- if eq .dbType "oracle" }}
|
{{- if eq .dbType "oracle" }}
|
||||||
spring.datasource.url=jdbc:oracle:thin:@//{{ .dbHost }}:1521/ORCLCDB
|
spring.datasource.url=jdbc:oracle:thin:@//{{ .dbHost }}:{{ .dbPort }}/ORCLCDB
|
||||||
{{- else if eq .dbType "postgresql" }}
|
{{- else if eq .dbType "postgresql" }}
|
||||||
spring.datasource.url=jdbc:postgresql://{{ .dbHost }}:5432/{{ .dbDatabase }}?useUnicode=true&characterEncoding=utf8&autoReconnect=true&stringtype=unspecified
|
spring.datasource.url=jdbc:postgresql://{{ .dbHost }}:{{ .dbPort }}/{{ .dbDatabase }}?useUnicode=true&characterEncoding=utf8&autoReconnect=true&stringtype=unspecified
|
||||||
{{- else if eq .dbType "mysql" }}
|
{{- else if eq .dbType "mysql" }}
|
||||||
spring.datasource.url=jdbc:mysql://${DB_HOST:10.0.2.201:3306}/${DB_DATABASE:hande_test}?characterEncoding=utf-8&serverTimezone=Asia/Shanghai
|
spring.datasource.url=jdbc:mysql://${DB_HOST:10.0.2.201:3306}/${DB_DATABASE:hande_test}?characterEncoding=utf-8&serverTimezone=Asia/Shanghai
|
||||||
{{- else if eq .dbType "dm"}}
|
{{- else if eq .dbType "dm"}}
|
||||||
spring.datasource.url=jdbc:dm://${ .dbHost }/5236/SYSDBA?characterEncoding=utf-8&serverTimezone=Asia/Shanghai
|
spring.datasource.url=jdbc:dm://${ .dbHost }/${ .dbPort }/SYSDBA?characterEncoding=utf-8&serverTimezone=Asia/Shanghai
|
||||||
{{- end }}
|
{{- end }}
|
||||||
spring.datasource.username=${DB_USER:hande_test_user}
|
spring.datasource.username=${DB_USER:hande_test_user}
|
||||||
spring.datasource.password=${DB_PASSWORD:Yu0FvhjUQDGdnmm5}
|
spring.datasource.password=${DB_PASSWORD:Yu0FvhjUQDGdnmm5}
|
||||||
|
|||||||
@@ -1,72 +1,44 @@
|
|||||||
spring.profiles.active=local
|
spring.profiles.active=local
|
||||||
envs=local,remote,online,custom
|
envs=local,remote,online,custom
|
||||||
check=true
|
|
||||||
spring.main.allow-bean-definition-overriding=true
|
spring.main.allow-bean-definition-overriding=true
|
||||||
spring.mvc.pathmatch.matching-strategy=ANT_PATH_MATCHER
|
spring.mvc.pathmatch.matching-strategy=ANT_PATH_MATCHER
|
||||||
spring.jpa.open-in-view=false
|
|
||||||
spring.main.allow-circular-references=true
|
spring.main.allow-circular-references=true
|
||||||
spring.login.security.csrf=false
|
|
||||||
application.name={{ .projectName }}
|
|
||||||
mybatis.configuration.map-underscore-to-camel-case=true
|
mybatis.configuration.map-underscore-to-camel-case=true
|
||||||
project_id={{ .projectId }}
|
|
||||||
project_name={{ .projectName }}
|
|
||||||
base.package={{.groupId}}
|
base.package={{.groupId}}
|
||||||
{{- if eq .dbType "mysql" }}
|
{{- if eq .dbType "mysql" }}
|
||||||
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
||||||
hibernate.dialect=org.hibernate.dialect.MySQLDialect
|
#mysql | oracle | postgresql
|
||||||
|
db.type=mysql
|
||||||
{{- else if eq .dbType "postgresql" }}
|
{{- else if eq .dbType "postgresql" }}
|
||||||
spring.datasource.driver-class-name=org.postgresql.Driver
|
spring.datasource.driver-class-name=org.postgresql.Driver
|
||||||
vs.sqlmapper.dialect=postgresql
|
#mysql | oracle | postgresql
|
||||||
|
db.type=postgresql
|
||||||
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
|
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
|
||||||
hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
|
hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
|
||||||
{{- else if eq .dbType "oracle" }}
|
{{- else if eq .dbType "oracle" }}
|
||||||
spring.datasource.driver-class-name=oracle.jdbc.OracleDriver
|
spring.datasource.driver-class-name=oracle.jdbc.OracleDriver
|
||||||
hibernate.dialect=org.hibernate.dialect.OracleDialect
|
hibernate.dialect=org.hibernate.dialect.Oracle10gDialect
|
||||||
vs.sqlmapper.dialect=oracle
|
#mysql | oracle | postgresql
|
||||||
|
db.type=oracle
|
||||||
{{- else if eq .dbType "dm" }}
|
{{- else if eq .dbType "dm" }}
|
||||||
spring.datasource.driver-class-name=dm.jdbc.driver.DmDriver
|
spring.datasource.driver-class-name=dm.jdbc.driver.DmDriver
|
||||||
hibernate.dialect=org.hibernate.dialect.DmDialect
|
hibernate.dialect=org.hibernate.dialect.DmDialect
|
||||||
vs.sqlmapper.dialect=dm
|
#mysql | oracle | postgresql
|
||||||
|
db.type=dm
|
||||||
{{- end }}
|
{{- end }}
|
||||||
com.toco.agent.attach=false
|
|
||||||
|
|
||||||
#create default table
|
#create default table
|
||||||
vs.db.basetable.create=true
|
db.basetable.create=true
|
||||||
server.ssl.enabled=false
|
|
||||||
server.forward-headers-strategy=framework
|
|
||||||
#request header
|
|
||||||
out.request.headers=
|
|
||||||
#response header
|
|
||||||
out.response.headers=Content-Type
|
|
||||||
#custom corss-domain headers, split by ','
|
|
||||||
cross.domain.headers=
|
|
||||||
#eg:https://vsstudio.teitui.com
|
|
||||||
out.host=
|
|
||||||
#hibernate.show_sql=true
|
#hibernate.show_sql=true
|
||||||
#vs.sqlmapper.showSql=true
|
|
||||||
mock.enabled=false
|
|
||||||
|
|
||||||
## message config , use memory for test, mq.type can be redis/rocketmq/kafka
|
## message config , use memory for test, mq.type can be redis/rocketmq/kafka
|
||||||
mq.type=memory
|
mq.type=memory
|
||||||
|
spring.autoconfigure.exclude=org.redisson.spring.starter.RedissonAutoConfiguration
|
||||||
|
#redis
|
||||||
|
#spring.redis.host=${REDIS_HOST:localhost}
|
||||||
|
#spring.redis.port=6379
|
||||||
|
#spring.redis.timeout=3000
|
||||||
|
|
||||||
#rocketmq.name-server=${ROCKETMQ_HOST:10.0.2.221:9876;10.0.2.222:9876;10.0.2.223:9876}
|
#rocketmq.name-server=${ROCKETMQ_HOST:10.0.2.221:9876;10.0.2.222:9876;10.0.2.223:9876}
|
||||||
|
|
||||||
#redis
|
|
||||||
#redis-config.pool.hostAndPort=${REDIS_HOST:redis.byteawake.com:6379}
|
|
||||||
#redis-config.pool.password=${REDIS_PASSWORD:}
|
|
||||||
#redis-config.pool.maxTotal=100
|
|
||||||
#redis-config.pool.maxIdle=10
|
|
||||||
#redis-config.pool.minIdle=10
|
|
||||||
#redis-config.pool.maxWaitMillis=10000
|
|
||||||
#redis-config.pool.softMinEvictableIdleTimeMillis=10000
|
|
||||||
#redis-config.pool.testOnBorrow=true
|
|
||||||
#redis-config.pool.testOnReturn=true
|
|
||||||
#redis-config.pool.testWhileIdle=true
|
|
||||||
#redis-config.pool.timeBetweenEvictionRunsMillis=30000
|
|
||||||
#redis-config.pool.minEvictableIdleTimeMillis=1800000
|
|
||||||
#redis-config.pool.numTestsPerEvictionRun=3
|
|
||||||
#redis-config.pool.blockWhenExhausted=true
|
|
||||||
#redis-config.pool.jmxEnabled=true
|
|
||||||
#redis-config.pool.lifo=true
|
|
||||||
|
|
||||||
#kafka.bootstrap-servers=localhost:9092
|
#kafka.bootstrap-servers=localhost:9092
|
||||||
|
|||||||
Reference in New Issue
Block a user