title: Spring MVC and AngularJS @RequestMapping
body: <p>I have built an application with Spring-boot and <code>AngularJS</code> with the <code>REST</code> End Point application. I got a little stuck with <code>@RequesMapping</code> in Spring Controller I've made. The problem is, I have the example url:</p>
  
  <pre><code>"localhost:8080/foo/bar/api/cardGenerated/0102". 
  </code></pre>
  
  <p>'01' is first parameter and '02' is second parameter. How can I mapped into <code>@RequestMapping</code> Spring controller to get a url above.</p>
  
  <p>Here's my controller : </p>
  
  <pre><code>@RestController
  @RequestMapping("/api")
  public class CardGeneratedResource {
  @RequestMapping(value = "/cardGenerated/{branchCode}{cardType}",
              method = RequestMethod.GET,
              produces = MediaType.APPLICATION_JSON_VALUE)
      @Timed
      public ResponseEntity&lt;CardGenerated&gt; get(@PathVariable("branchCode") String branchCode,
                                               @PathVariable("cardType") String cardType,
                                               HttpServletResponse response) {
  
          log.debug("REST request to get CardGenerated : " + branchCode + " and " + cardType);
  
          CardGenerated cardGenerated = cardGeneratedRepository.
                  findTopByBranchCodeAndCardTypeOrderByCardNumberDesc(branchCode, cardType);
  
          if (cardGenerated == null) {
              return new ResponseEntity&lt;&gt;(HttpStatus.NOT_FOUND);
          }
  
          return new ResponseEntity&lt;&gt;(cardGenerated, HttpStatus.OK);
      }
  }
  </code></pre>
  
  <p>so this is my AngularJS <code>$resource</code>:</p>
  
  <pre><code>'use strict';
  
  angular.module('itmApp')
      .factory('CardGenerated', function ($resource) {
          return $resource('api/cardGenerated/:branchCode:cardType', {}, {
              'query': { method: 'GET', isArray: true},
              'get': {
                  method: 'GET',
                  transformResponse: function (data) {
                      data = angular.fromJson(data);
                      return data;
                  }
              }
          });
      });
  </code></pre>
  
  <p>I always got <code>'Failed to load resource: the server responded with a status of 404 (Not Found)'</code>.</p>