File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
spring-framework-reference/src Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change 181
181
</listitem >
182
182
</itemizedlist >
183
183
</section >
184
+ <section >
185
+ <title >JPA EntityManagerFactory bootstrapping without persistence.xml</title >
186
+ <para >In standard JPA, persistence units get defined through <literal >META-INF/persistence.xml</literal >
187
+ files in specific jar files which will in turn get searched for <literal >@Entity</literal > classes.
188
+ In many cases, persistence.xml does not contain more than a unit name and relies on defaults and/or
189
+ external setup for all other concerns (such as the DataSource to use, etc). For that reason, Spring 3.1
190
+ provides an alternative: <classname >LocalContainerEntityManagerFactoryBean</classname > accepts a
191
+ 'packagesToScan' property, specifying base packages to scan for <literal >@Entity</literal > classes.
192
+ This is analogous to <classname >AnnotationSessionFactoryBean</classname >'s property of the same name
193
+ for native Hibernate setup, and also to Spring's component-scan feature for regular Spring beans.
194
+ Effectively, this allows for XML-free JPA setup at the mere expense of specifying a base package for
195
+ entity scanning: a particularly fine match for Spring applications which rely on component scanning
196
+ for Spring beans as well, possibly even bootstrapped using a code-based Servlet 3.0 initializer.</para >
197
+ </section >
184
198
<section >
185
199
<title >New HandlerMethod-based Support Classes For Annotated Controller Processing</title >
186
200
<para >Spring 3.1 introduces a new set of support classes for processing requests
You can’t perform that action at this time.
0 commit comments