After working in rails for the past 18 months, I have a new project that takes me back into the Java world again. I am inheriting existing code, and I am amazed at how much the java world has missed the boat on simplicity. The framework Spring has become widely used and popular on the grounds that it is much more simple and easy than EJB. Well I used ejb for many years and never thought it to be that insanely complex, but Spring is for sure NOT simple.
I bought a book on it and the book on this simlple framework is 857 pages. Now to be fair the spring framework is large and covers lots of areas, but this looks more like .NET to me than simple.
My first bit of fun was just trying to get a working project that I can debug in Tomcat (I love to learn by stepping through running code), when I started up my debug server I got this error:
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Error registering bean with name 'myBean' defined in class path resource [my.xml]: Could not resolve placeholder 'myapp.myprop'
at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.processProperties(PropertyPlaceholderConfigurer.java:249)
at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:75)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:467)
....
I did some quick googling and at first didnt find anything helpful. Then I did some more and some trial and
error and finally figured out that my property file was not being found:
I changed:
<bean id="propConfig"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location">
<value>file:///Users/jnylund/Documents/workspace33/Project/src/myroject.properties </value>
</property>
</bean>
To:
<bean id="propConfig"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location">
<value>/WEB-INF/myroject.properties </value>
</property>
</bean>
And now it works. So my question is why cant the exception say:
"Dude, I cant find your properties file at this location: file:///Users/jnylund/Documents/workspace33/Project/src/myroject.properties "
Happy Coding.
Hi Joel,
Welcome back to Java... I guess it's not very useful to go into a debate about what simple means and whether or not enterprise programming is simple at all and whether error messages can show you how complex a framework is. I'm pretty certain for some web app development rails can be simpler for sure tho' ;-).
I'd like to urge you though to file JIRA issues for improvements you may find. Obviously I'm biased, but we pride ourselves in listening to our community and things like the issues you are finding are great input for us. Our JIRA issue tracker can be found at http://jira.springframework.org.
If you have any other issues, please don't hesitate to ping me.
Posted by: Alef Arendsen | December 11, 2008 at 06:23 PM