Reputation: 11916
As a relatively new comer to the Spring world, I figured it would be nice to have a community Wiki page that lists common pitfalls in Spring-based projects.
These include:
Misunderstood concepts
Popular features from Spring 2.X that are no longer recommeded in Spring 3.X
Abused features
Performance killers
Upvotes: 2
Views: 866
Reputation: 485
Mixing Annotation-based configuration with XML-based configuration. Happens to me all the time...
Upvotes: 2
Reputation: 340993
Calling public methods using this
when inside a proxy-enriched bean. This is a recurring problem in StackOverflow, explained here.
Injecting bean with prototype
scope does not mean you'll have a new instance every time you use this bean. Explain lookup-method
. Also: how to use session-scoped beans in singletons.
Spring can be used outside of the web container. Example of ClassPathXmlApplicationContext
.
Proper usage of Spring testing support. Explain default transaction behavior.
Upvotes: 1
Reputation: 80192
Most abused and misunderstood concept: Not everything need to be injected.
Others:
Performance problems when using lots of AOP request scoped beans (perf)
Singleton beans are loaded differently in BeanFactory and ApplicationContext. A bean factory lazily loads all beans, deferring bean creation until the getBean() method is called. An application context loads all singleton beans upon context startup.
Upvotes: 3
Reputation: 11916
I'll start first. Use of DAO templates, such as JpaDaoSupport and JpaTemplate for JPA, is no longer recommended in Spring 3 in favour of direct use of JPA.
Upvotes: 0