title: How to create a middleware on controller level in spring boot java?
body: <p>I want to create a middleware when request comes on controller like we did in express Nodejs.</p>
  <pre><code>var myLogger = function (req, res, next) {
    console.log('LOGGED')
    next()
  }
  app.use(myLogger)
  api.post('/', function(req,res) {
    // enter code here...
  })
  </code></pre>
  <p>Is it possible in spring boot doing the same functionality
  Like</p>
  <pre><code>@RestController
  @RequestMapping(&quot;/api&quot;)
  private class TestApiMiddleware {
    // middleware...
    @RequestMapping(value = &quot;/save&quot;, method = RequestMethod.POST)
      protected list() throws Exception {
          // code...
      }
  }
  </code></pre>