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 {
|
||||
|
||||
Reference in New Issue
Block a user