A Techno Blog, mainly about Java

The Spring Stack 2008 – Part1

Spring 2.0 introduced support for various annotations for configuration purposes, such as:

  • @Transactional – The @Transactional annotation may be placed before an interface definition, a method on an interface, a class definition, or a public method on a class. However, please note that the mere presence of the @Transactional annotation is not enough to actually turn on the transactional behavior.
  • @Required – used to mark a property as being ‘required-to-be-set’ (i.e. an annotated (setter) method of a class must be configured to be dependency injected with a value)
  • @PersistenceContext – annotated on EntityManager instances are not thread safe
  • @PersistenceUnit – annotated on EntityManagerFactory instances are thread-safe

Thus, to use annotations for the transactions for my purposes, I do the following:

  1. Put an tag tx:annotation-driven in the config file (i.e applicationContext.xml)
  2. Put @Transactional annotation in the services class implementation that contains operations on the entity manager

Spring 2.5 introduces support for a complete set of configuration annotations:

  • @Autowired in combination with support for the JSR-250 annotations @Resource
  • @PostConstruct
  • @PreDestroy

July 16, 2008 - Posted by | Uncategorized

1 Comment »

  1. […] , Testing , Spring 2.0 , IBatis Spring , Web […]

    Pingback by Core Spring via Interface21~SpringSource~VMWare « TechnoBuzz | June 29, 2010 | Reply

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: