dateFormat
This commit is contained in:
@@ -6,10 +6,15 @@ import java.util.Date;
|
||||
|
||||
public class MyDateFormat extends DateFormat {
|
||||
private static final long serialVersionUID = -4580955831439573829L;
|
||||
private static final String customDateFormat = "yyyy-MM-dd HH:mm:ss";
|
||||
private DateFormat dateFormat;
|
||||
private SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
public MyDateFormat() {
|
||||
this.calendar = Calendar.getInstance();
|
||||
this.dateFormat = simpleDateFormat;
|
||||
}
|
||||
|
||||
|
||||
public MyDateFormat(DateFormat dateFormat) {
|
||||
this.calendar = Calendar.getInstance();
|
||||
this.dateFormat = dateFormat;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package {{ .package }}.common.response;
|
||||
|
||||
import {{ .package }}.common.utils.ObjectMapperFactory;
|
||||
import com.vs.ex.BizException;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@@ -38,17 +39,6 @@ public class ResponseJsonExceptionResolver extends AbstractHandlerExceptionResol
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
protected ModelAndView doResolveException(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) {
|
||||
FailData failData = new FailData();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package {{ .package }}.common.response;
|
||||
|
||||
import {{ .package }}.common.utils.ObjectMapperFactory;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.http.MediaType;
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
@Configuration
|
||||
@ComponentScan("com.vs.ox")
|
||||
@ComponentScan("com.vs")
|
||||
public class
|
||||
WebMvcConfiguration extends WebMvcConfigurerAdapter implements ApplicationContextAware {
|
||||
RequestMappingHandlerAdapter requestMappingHandlerAdapter;
|
||||
@@ -37,9 +37,7 @@ WebMvcConfiguration extends WebMvcConfigurerAdapter implements ApplicationContex
|
||||
List<HandlerMethodReturnValueHandler> newProcessors = new ArrayList<>();
|
||||
while (iterator.hasNext()) {
|
||||
HandlerMethodReturnValueHandler next = iterator.next();
|
||||
//为了能在controller中直接返回map,不被默认的MapMethodProcessor拦截
|
||||
if (next instanceof MapMethodProcessor ||
|
||||
//为了能在controller中直接返回String,不被默认的ViewNameMethodReturnValueHandler拦截
|
||||
next instanceof ViewNameMethodReturnValueHandler) {
|
||||
continue;
|
||||
} else {
|
||||
|
||||
@@ -1,27 +1,18 @@
|
||||
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.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
|
||||
@SpringBootApplication(scanBasePackages = {"{{.groupId}}", "com.vs"})
|
||||
@VSDaoBeanScan(basePackages = {"com.vs","{{.groupId}}"})
|
||||
@Import(DataSourceConfig.class)
|
||||
@MapperScan("{{.groupId}}.**.persist.mapper.mybatis")
|
||||
@EnableScheduling
|
||||
public class AppApplication{
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication application = new SpringApplication(AppApplication.class);
|
||||
application.addInitializers(new TocoAgentInitializer());
|
||||
application.run(args);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user