title: @PreAuthorize doesn't work with function which is called from another function
body: <p>I am trying to understand spring security. I am using java-config instead of xml. I tried creating a controller and then tested <code>@PreAuthorize</code> notation. But in my given code this <code>@PreAuthorize</code> only works if I use it with the <code>getActiveSessions</code> function but it has no effect when I use it with <code>getName</code> function. So this code works as expected</p>
  
  <pre><code>public class DemoSessionController extends SessionController{
  
          @RequestMapping("/welcome/{a}")
          @PreAuthorize("hasRole('ROLE_ADMIN')")
          public String getActiveSessions(@PathVariable String a) {
              // TODO Auto-generated method stub
              String str = getName(a);
              return str;
          }
  
          public String getName(String name) {
              // TODO Auto-generated method stub
              return "This is "+name+"";
          }
      }
  </code></pre>
  
  <p>But this doesn't</p>
  
  <pre><code>public class DemoSessionController extends SessionController{
  
      @RequestMapping("/welcome/{a}")
      public String getActiveSessions(@PathVariable String a) {
          // TODO Auto-generated method stub
          String str = getName(a);
          return str;
      }
  
      @PreAuthorize("hasRole('ROLE_ADMIN')")
      public String getName(String name) {
          // TODO Auto-generated method stub
          return "This is "+name+"";
      }
  }
  </code></pre>
  
  <p>Can someone explain why the second case doesn't work and how can I make it work? Thanks !!</p>