title: How to dynamically decide <intercept-url> access attribute value in Spring Security?
body: <p>In Spring Security we use the intercept-url tag to define the access for URLs as below:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;intercept-url pattern="/**" access="ROLE_ADMIN" /&gt;
  &lt;intercept-url pattern="/student" access="ROLE_STUDENT" /&gt;
  </code></pre>
  
  <p>This is hard coded in <code>applicationContext-security.xml</code>. I want to read the access values from a database table instead. I have defined my own <code>UserDetailsService</code> and I read the roles for the logged in user from the database. How do I assign these roles to the URL patterns during runtime?</p>