Showing posts with label Spring Framework. Show all posts
Showing posts with label Spring Framework. Show all posts
Friday, January 18, 2013
Next stop - Spring 4.0
Spring will reach to 4.0 at the end of 2013. One of highlight features is new features of Java SE 8.0 and Java EE 7.0 will be supported. Included Lambda, JSR310 Date and Time, JMS 2.0, JPA 2.1, Bean Validation 1.1, Servlet 3.1, JCache and JSR356 WebSocket support. Another highlight feature is you will be able to write Spring configuration with Groovy-style.
Friday, January 11, 2013
@Resource, @Inject and @Autowired
@Resource is from JSR250 (Common Annotations for Java), when you write an app on Java EE platform, you can use @Resource to get reference from the container, like DataSource or SipFactory (from Sip Servlet) or something else you defined in your container. @Inject, it totally for DI, from JSR330 (Dependency Injection for Java). In Spring application, @Reource and @Inject and @Autowired are similar, but out of Spring, it will be another story.
Tuesday, January 8, 2013
Spring Migration Analyzer
If you want to migrate your application from JavaEE platform to Spring platform, you can use Spring Migration Analyzer to scan your app then get a suggestion report. The input of this tool is the byte package of your app, not the source package. And when you use SMA, you have to configure it. For example, you should tell SMA to exclude dependent jars of your project.
For more information, go to SpringSource.org
Monday, December 31, 2012
Spring Java-based configuration
From Spring 3.0, we can configure our Spring application with a new way: Java-based configuration. With Java-based configuration, you can migrate all XML configuration files to configuration Java class. With that, you can avoid typing errors and enjoy the programmatic features. Though some IDEs, like Intellij IDEA can make you away from typing errors, but with Java-based configuration, you can enjoy this feature on all of IDEs, even with text editors.
In my opinion, Spring configuration best practice is use Annotation configure your own code. For 3rd party classes, Java-based configuration is a good choice.
The following are some samples from Spring 3.0 Documentation.
XML-based configuration load Java-based configurationJava-based configuration load XML-based configuration
Specifying bean scope
Subscribe to:
Posts (Atom)