Java Ninja Chronicles By Norris Shelton

Things I learned in the pursuit of code

My production Springframework code doesn’t normally need to get the datasource directly because I choose to inject the template. However, sometimes there is a need to get the datasource.

The datasource is usually defined as

<jee:jndi-lookup id="jxportalDs" jndi-name="jdbc/jxportal"/>

If you try to inject that with

    @Resource(name = "jxportalDs")
    private DataSource dataSource;

You will get compile problems because the the code declares a type of DataSource, but there is not a type declared for Datasource. This can be fixed by adding a type to your jndi declaration

<jee:jndi-lookup id="jxportalDs" jndi-name="jdbc/jxportal" expected-type="javax.sql.DataSource"/>

December 6th, 2011

Posted In: Java, Spring

Leave a Comment

Something like this normally works on Linux:

find . -type D -name .svn | rm -r

Not on Mac. You have to remember to add xargs

find . -type D -name .svn | xargs rm -r

Without the xargs, it is like calling rm without a target.

December 5th, 2011

Posted In: Mac, OS/X

Tags: , ,

Leave a Comment

LinkedIn Auto Publish Powered By : XYZScripts.com