title: What does java:comp/env/ do?
body: <p>I just spent too much time of my day trying to figure out some errors when hooking up some JNDI factory bean. The problem turned out to be that instead of this...</p>
  
  <pre><code>&lt;bean id="someId" class="org.springframework.jndi.JndiObjectFactoryBean"&gt;
    &lt;property name="jndiName" value="java:comp/env/jdbc/loc"/&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>I had actually written this...</p>
  
  <pre><code>&lt;bean id="someId" class="org.springframework.jndi.JndiObjectFactoryBean"&gt;
    &lt;property name="jndiName" value="jdbc/loc"/&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>I infer that the <code>java:comp/env/</code> perhaps references some environment variable and makes it so that, ultimately, my context file is looked at.  The only difference is <code>java:comp/env/</code>. From an expert's mouth, what does that do?</p>
  
  <p>Without the <code>java:comp/env/</code> prefix in the value, I would get an error that said <em>"Name jdbc is not bound in this Context"</em>.</p>