Created
March 25, 2013 10:26
-
-
Save senthilmuthiah/5236227 to your computer and use it in GitHub Desktop.
Address Book Using JPA +ZK + Spring.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<beans xmlns="http://www.springframework.org/schema/beans" | |
xmlns:p="http://www.springframework.org/schema/p" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" | |
xsi:schemaLocation=" | |
http://www.springframework.org/schema/beans | |
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd | |
http://www.springframework.org/schema/context | |
http://www.springframework.org/schema/context/spring-context-3.0.xsd | |
http://www.springframework.org/schema/tx | |
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"> | |
<!-- The LocalEntityManagerFactoryBean creates an EntityManagerFactory suitable for environments which solely use JPA for data access. | |
The factory bean will use the JPA PersistenceProvider autodetection mechanism (according to JPA's Java SE bootstrapping) and, | |
in most cases, requires only the persistence unit name to be specified: | |
--> | |
<bean id="entityManagerFactory" | |
class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean"> | |
<property name="persistenceUnitName" value="ZKExamples" /> | |
</bean> | |
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"> | |
<property name="entityManagerFactory" ref="entityManagerFactory" /> | |
</bean> | |
<!-- tell spring to use annotation based congfigurations --> | |
<!-- It allow us to use @Autowire, @Required and @Qualifier annotations. --> | |
<context:annotation-config /> | |
<!-- tell spring where to find the beans --> | |
<!-- tells Spring to scan the code for injectable beans under the package (and all its subpackages) specified. --> | |
<!-- It allow @Component, @Service, @Controller, etc.. annotations. --> | |
<context:component-scan base-package="addressbook" /> | |
<tx:annotation-driven transaction-manager="transactionManager" /> | |
<!-- This will ensure that hibernate or jpa exceptions are automatically | |
translated into Spring's generic DataAccessException hierarchy for those | |
classes annotated with Repository --> | |
<bean | |
class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor" /> | |
<bean id="CRUDService" class="addressbook.service.CRUDServiceImpl" /> | |
</beans> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment