Welcome to my website. I am always posting links to photo albums, art, technology and other creations. Everything that you will see on my numerous personal sites is powered by the formVistaTM Website Management Engine.

icon.linkedin.jpgicon.twitter.jpg

  • Excellent Example and Explanation on How to Inject Properties from an External Properties File from Outside of a WAR in a Spring Application
    01/29/2014 8:39PM

    I am doing some refactoring on a Spring MVC application, pulling out configuration data and login crentials from the spring.xml file.

    What I want to do is to consolodate sensitive data into external .properties files that can be read, at runtime by the app and not require recompiling the war to make changes.

    Thanks to Ben Northrop and Summa Technologies for such a clear, concise and well written article.

    The long and the short of it (copied from the aforementioned article) is to add the following to your spring.xml

    <bean id="propertyPlaceholderConfigurer"  
    class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> 
      <property name="locations"> 
        <list> 
          <value>classpath:database.properties</value> 
        </list> 
      </property> 
    </bean> 

    <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"> 
      <property name="user" value="${db.user}"/> 
      <property name="password" value="${db.password}"/> 
      ... 
    </bean>

  • Do Not Use Symlinks in Jetty's webapps Directory
    09/18/2013 4:07PM

    I set up a development instance of Jetty on my local machine and have been happily coding, compiling and deploying via a shell script.  The script copies the war from my user's target directory to the jetty users's home dir changes the permissions and then moves it to the /webapp dir creating a symlink to the name of the .war that is referenced in a number of config files.

    This was working just fine until I did a merge with another developers code and a significant portion of it changed that Jetty had problems determining whether or not is should dump it's local cache of .class files and configs and got into a very funky state.  Unfortunately, not one in which it was obviously funky, but where, all of the sudden I could not look up defined DataSources in JNDI.

    Ultimately, after looking through many other different things, I decided to delete the symlink and, rename the .war in the /webapps dir.

    Bingo, worked right away.

Advanced Search

Categories

Archives