title: spring boot jms initialcontext
body: <p>I'm looking to configure a Spring boot application to do a JNDI lookup (configure initialContext) of the connection. This is running as a standalone Spring boot application (not on an application server). I have the following which works fine, although I provide all the configuration values myself (not setting timeouts/etc here, but would normally be):</p>
  
  <pre><code>@Bean
  public ConnectionFactory tibJmsConnectionFactory() throws JMSException {
      TibjmsConnectionFactory myFac = new TibjmsConnectionFactory();
      myFac.setServerUrl("tcp://xxxxx:7222");
      myFac.setUserName("xxxxxxx");
      myFac.setUserPassword("xxxxxx");
      return myFac;
  }
  
  @Bean
  public JmsListenerContainerFactory&lt;?&gt; myFactory(ConnectionFactory connectionFactory,
                                                  DefaultJmsListenerContainerFactoryConfigurer configurer) {
      DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
      configurer.configure(factory, connectionFactory);
      return factory;
  }
  </code></pre>
  
  <p>When running on an application server, you can set up a JNDI context URL to pull configuration values (timeouts/etc) from an external connection (in our case, the source JMS server) by specifying an "Initial Context Factory" on the JNDI connection. How I can do the equivalent from a Spring boot application not running on an application server?</p>