spring mvc拦截器获取参数问题

目录
一、拦截器对于参数的验证问题
二、尝试方案之使用拦截器
三、使用spring的注解 @ControllerAdvice

一:拦截器对于参数的验证问题

问题场景:
由于之前的参数验证都是放在参数体里面,没有放到方法参数上或者头部,请求数据参数格式为json所以对于所有的接口,我需要验证这公共部分的正确与否,所以我现在需要对请求到controller之前进行拦截,并进行这部分公共参数的验证,所以本身最先想到了两种方案时使用过滤器,要么使用拦截器,但是做的过程中得到第三种方案。具体见下


二、尝试方案之使用拦截器

2.1先上代码如下:

public class AuthInterceptor extends HandlerInterceptorAdapter {
private static final Logger log = Logger.getLogger(AuthInterceptor.class);
//本来时打算在这里面获取到参数,然后对公共部分进行验证    
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
        throws Exception {
        String token = request.getParameter("appId");;
        if(StringUtils.isblack(token)){
               //使用流写出对象,提示token不能为空;
               ResultBean result = new ResultBean("10001","token不能为空")
               ...
              return false;
          }
        //注释一
        /*
        StringBuffer sb = new StringBuffer();
        InputStreamReader isr = new InputStreamReader(request.getInputStream());
        BufferedReader br = new BufferedReader(isr);  
         String s = "";   
         while ((s = br.readLine()) != null) {  
             sb.append(s);  
         }  
         System.out.println(sb.toString());
        */

        //注释二
        /*  
        if(handler instanceof HandlerMethod){
            HandlerMethod handlerMethod = (HandlerMethod)handler;
            MethodParameter[] methodParameters = handlerMethod.getMethodParameters();
            for(MethodParameter methodParameter : methodParameters){
            System.out.println(methodParameter.getParameterName());
            }
        }
        }
       */  

xml中配置如下:
<mvc:interceptors>
    <mvc:interceptor>
        <mvc:mapping path="/*.cgi"/>
        <mvc:mapping path="/test/*.cgi"/>
        <bean class="com.mouse.moon.common.auth.AuthInterceptor"></bean>
    </mvc:interceptor>
</mvc:interceptors>

上述代码部分,可以看出,我在preHandle(...) 方法中想获取参数,然后
在这里面做统一的验证,成功则继续望下走,失败则直接以流的形式写出
错误对象。在前面的问题中已经说明,参数是以json的格式传入到后台,
并且功能部分都是放在json的数据中,所以这里request获取到的数据为
空数据。
2.2 :看到注释一中的代码,我在这里使用流的形式来读取到请求数据,然后此时我获取到相关的参数,可是当我继续往下走时,请求到达controller却报错,错误的意思大致就是说流没了,因为我们在拦截器里面读取了流,所以在controller中没办法再次读取流了,使得其直接抛出异常。异常如下:

org.springframework.http.converter.HttpMessageNotReadableException: Required request body is missing: public com.mouse.moon.common.bean.ResultBean com.mouse.person.controller.PersonController.getPersonInfo(com.mouse.moon.common.bean.ParameBean) throws com.mouse.moon.common.exception.ExceptionAbstract
    at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.readWithMessageConverters(RequestResponseBodyMethodProcessor.java:151)
    at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.resolveArgument(RequestResponseBodyMethodProcessor.java:125)
    at org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:78)
    at org.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:162)
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:129)
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:814)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:737)
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:121)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1074)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
    at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2466)
    at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2455)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:745)

主要是“Failed to read HTTP message: org.springframework.http.converter.HttpMessageNotReadableException: Required request body is missing:”
所以我就在想,那么此时我们既然读到了流,然后再把流写出不就可以了,可是我查阅了下资料,发现拦截器没办法进行这操作,倒是过滤器时可以获取到流后再写回去。
然后我又试验了网上说的使用注释二的代码进行参数获取,结果获取的参数都是空的。
所以至此,使用拦截器来做参数验证这一步基本上宣告失败了,必须得另外处理方式,所以打算使用过滤器,但是再解决的过错中跟朋友交流了下,说到有这么一个注解 @ControllerAdvice结合HttpEntity<String> 来使用,我就转门去看了下,得到了我最后的解决方案,当然,过滤器的查到的资料可以试试
https://my.oschina.net/vernon/blog/363693?fromerr=2jheR52d

三、使用spring的注解 @ControllerAdvice

3.1: @ControllerAdvice说明
该注解时再spring3.2之后增加的,见名大概意思是控制器增强。
@ControllerAdvice注解内部使用@ExceptionHandler、@InitBinder、@ModelAttribute注解的方法应用到所有的 @RequestMapping注解的方法。
3.2:描述
我这里使用了结合的方式使用,@ModelAttribute结合@ExceptionHandler进行结合使用,现在@ModelAttribute中进行参数获取,然后转换为相应的对象,获取后对参数进行验证,但是验证失败后我们要怎么处理了,这里面没办法返回错误码呀,所以如果验证失败就抛出异常,然后再@ExceptionHandler中进行统一处理。验证通过就吧获取的参数返回即可,那么此时在controller中获取参数需要使用@ModelAttribute进行获取。代码如下:

@ControllerAdvice
public class ValidateControllerAdvice {

    private static final Logger log = Logger.getLogger(ValidateControllerAdvice.class);

    @ModelAttribute
    public ParameBean getBobyInfo(HttpEntity<String> httpEntity,HttpServletRequest request,HttpServletResponse response) throws JsonParseException, JsonMappingException, IOException, CommonValidateException {    
    //获取参数
        String data = httpEntity.getBody();
        ObjectMapper objectMapper =  new ObjectMapper();
        ParamBean paramBean = data != null ? objectMapper.readValue(data, ParamBean.class) : null;
        if (pb != null)
        {
            String secretId = paramBean.getSecretId();
            String token = paramBean.getToken();
            if(StringUtils.isBlank(secretId)){
                throw new ValidateException( Enums.ERROR_SECRETID_NOTNULL,
                        "SECRETID不能为空");
            }else if(StringUtils.isBlank(token)){
                throw new ValidateException( Enums.ERROR_TOKEN_NOT_NULL,
                        "token不能为空");
            }else if(validate(token)){
                        throw new ValidateException( Enums.ERROR_TOKEN_INVALID,
                        "无效的token");  
              }
        }
        return paramBean;    
    }
    
     //捕获ValidateException的异常,统一返回
    @ExceptionHandler({ValidateException.class})
    @ResponseBody
    public ResultBean validateException(ValidateException ex){
        ResultBean result = new ResultBean();
        result.setResultCode(ex.getResultCode());
        result.setResultMsg(ex.getResultMsg());
        return result;
    }
}

四:隐患

几天后,测试发现了一个问题,就是比如我的返回数据,我想转换时间不反回长整形,而是"yyyy-MM-dd HH:mm:ss"的形式,所以我使用jackson的配置方案如下

  
      
      <mvc:annotation-driven>
        <mvc:message-converters>
            <bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
                <property name="objectMapper">
                    <bean class="com.fasterxml.jackson.databind.ObjectMapper">
                        <property name="serializationInclusion" value="NON_NULL"/>
                          <property name="dateFormat">  
                            <bean class="java.text.SimpleDateFormat">  
                                <constructor-arg type="java.lang.String" value="yyyy-MM-dd HH:mm:ss" />  
                            </bean>  
                        </property>  
                    </bean>
                </property>
                <property name="supportedMediaTypes">
                    <list>
                        <value>application/json;charset=UTF-8</value>
                    </list>
                </property>
            </bean>
        </mvc:message-converters>
     </mvc:annotation-driven> 

测试得到的结果是

org.springframework.http.converter.HttpMessageNotReadableException: Could not read document: Can not deserialize instance of java.lang.String out of START_OBJECT token
 at [Source: java.io.PushbackInputStream@3a4f5e0b; line: 1, column: 1]; nested exception is com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.lang.String out of START_OBJECT token
 at [Source: java.io.PushbackInputStream@3a4f5e0b; line: 1, column: 1]
    at org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.readJavaType(AbstractJackson2HttpMessageConverter.java:224)
    at org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.read(AbstractJackson2HttpMessageConverter.java:208)
    at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodArgumentResolver.readWithMessageConverters(AbstractMessageConverterMethodArgumentResolver.java:197)
    at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodArgumentResolver.readWithMessageConverters(AbstractMessageConverterMethodArgumentResolver.java:141)
    at org.springframework.web.servlet.mvc.method.annotation.HttpEntityMethodProcessor.resolveArgument(HttpEntityMethodProcessor.java:123)
    at org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:78)
    at org.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:162)
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:129)
    at org.springframework.web.method.annotation.ModelFactory.invokeModelAttributeMethods(ModelFactory.java:136)
    at org.springframework.web.method.annotation.ModelFactory.initModel(ModelFactory.java:109)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:792)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:737)
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:121)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1074)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
    at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2466)
    at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2455)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:745)
Caused by: com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.lang.String out of START_OBJECT token
 at [Source: java.io.PushbackInputStream@3a4f5e0b; line: 1, column: 1]
    at com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:148)
    at com.fasterxml.jackson.databind.DeserializationContext.mappingException(DeserializationContext.java:762)
    at com.fasterxml.jackson.databind.deser.std.StringDeserializer.deserialize(StringDeserializer.java:59)
    at com.fasterxml.jackson.databind.deser.std.StringDeserializer.deserialize(StringDeserializer.java:12)
    at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3066)
    at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2221)
    at org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.readJavaType(AbstractJackson2HttpMessageConverter.java:221)
    ... 44 more
2016-12-10 16:47:28 [ http-apr-8080-exec-6:20921 ] - [ DEBUG ] Resolving exception from handler [public com.mouse.common.bean.ResultBean com.mouse.person.controller.PersonController.getPersonInfo(com.mouse.common.bean.ParameBean)]: org.springframework.http.converter.HttpMessageNotReadableException: Could not read document: Can not deserialize instance of java.lang.String out of START_OBJECT token
 at [Source: java.io.PushbackInputStream@3a4f5e0b; line: 1, column: 1]; nested exception is com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.lang.String out of START_OBJECT token
 at [Source: java.io.PushbackInputStream@3a4f5e0b; line: 1, column: 1]
2016-12-10 16:47:28 [ http-apr-8080-exec-6:20921 ] - [ DEBUG ] Resolving exception from handler [public com.mouse.common.bean.ResultBean com.mouse.person.controller.PersonController.getPersonInfo(com.mouse.common.bean.ParameBean) throws com.mouse.common.exception.ExceptionAbstract]: org.springframework.http.converter.HttpMessageNotReadableException: Could not read document: Can not deserialize instance of java.lang.String out of START_OBJECT token
 at [Source: java.io.PushbackInputStream@3a4f5e0b; line: 1, column: 1]; nested exception is com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.lang.String out of START_OBJECT token
 at [Source: java.io.PushbackInputStream@3a4f5e0b; line: 1, column: 1]
2016-12-10 16:47:28 [ http-apr-8080-exec-6:20921 ] - [ DEBUG ] Resolving exception from handler [public com.mouse.common.bean.ResultBean com.mouse.person.controller.PersonController.getPersonInfp(com.mouse.common.bean.ParamBean)]: org.springframework.http.converter.HttpMessageNotReadableException: Could not read document: Can not deserialize instance of java.lang.String out of START_OBJECT token
 at [Source: java.io.PushbackInputStream@3a4f5e0b; line: 1, column: 1]; nested exception is com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.lang.String out of START_OBJECT token
 at [Source: java.io.PushbackInputStream@3a4f5e0b; line: 1, column: 1]
2016-12-10 16:47:28 [ http-apr-8080-exec-6:20921 ] - [ WARN ] Failed to read HTTP message: org.springframework.http.converter.HttpMessageNotReadableException: Could not read document: Can not deserialize instance of java.lang.String out of START_OBJECT token
 at [Source: java.io.PushbackInputStream@3a4f5e0b; line: 1, column: 1]; nested exception is com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.lang.String out of START_OBJECT token
 at [Source: java.io.PushbackInputStream@3a4f5e0b; line: 1, column: 1]
2016-12-10 16:47:28 [ http-apr-8080-exec-6:20921 ] - [ DEBUG ] Null ModelAndView returned to DispatcherServlet with name 'SpringMVC': assuming HandlerAdapter completed request handling
2016-12-10 16:47:28 [ http-apr-8080-exec-6:20922 ] - [ DEBUG ] Successfully completed request

想把所有的时间都转换了,但是发现这个在我接收参数的时候都有异常。今天在某位大神的指导下发现了问题所在,我们在加了转换器后,在发送请求的时候会讲json数据使用MappingJackson2HttpMessageConverter此类进行转换,那么到了HttpEntity时已经是对象了但是我们却还是使用HttpEntity<String>接收
所以一直抱上面的错误,转换异常。所以我们可以尝试如下

ObjectMapper objectMapper = new ObjectMapper();
String json="{\n"+"\t\"appId":"\"123567\",\n"+"\t\"appcode":"\"sdasfa\"+"}";
objectMapper.readValue(json,String.class);

此时就会报错如上。所以接收点需要修改为HttpEntity<ParamEngine>的写法,接收处就不需要在转换类型,getBody()后就是ParamEngine对象。

五:浩学习

                                 __                                                        
                   __  _  ____ __|  |__ _____    ___
                   \ \/ \/ /  |  \  |  \\__  \  /  _ \   
                    \     /|  |  /   Y  \/ __ \(  <_> )
                     \/\_/ |____/|___|  (____  /\____/ 
                                      \/     \/          
走在自己的路上,遇到要遇到的人,经历要经历的事,这才是我们需要面对的。努力,come on!!!
                                                        公元2016年12月7号凌晨00点35分
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 203,547评论 6 477
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 85,399评论 2 381
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 150,428评论 0 337
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 54,599评论 1 274
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 63,612评论 5 365
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,577评论 1 281
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 37,941评论 3 395
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,603评论 0 258
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 40,852评论 1 297
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,605评论 2 321
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,693评论 1 329
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,375评论 4 318
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 38,955评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,936评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,172评论 1 259
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 43,970评论 2 349
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,414评论 2 342

推荐阅读更多精彩内容

  • Spring Boot 参考指南 介绍 转载自:https://www.gitbook.com/book/qbgb...
    毛宇鹏阅读 46,724评论 6 342
  • 在前面我们搭建了基本的Spring Web MVC环境,并配置了一个控制器。下面我们来详细学习一下控制器。控制器的...
    乐百川阅读 806评论 0 2
  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 134,585评论 18 139
  • Spring的模型-视图-控制器(MVC)框架是围绕一个DispatcherServlet来设计的,这个Servl...
    alexpdh阅读 2,638评论 0 3
  • 控制器的主要作用就是处理特定URL发过来的HTTP请求,然后进行业务逻辑处理,将结果返回给某个特定的视图。 处理请...
    年少懵懂丶流年梦阅读 1,070评论 0 1