Database Reference
In-Depth Information
Repository configuration
Within the XML configuration approach, SDN repositories can be configured using the
<neo4j:repositories> element. The following snippet shows an example of how
to instruct Spring to look within the com.manning.neo4jia.chapter09.simple
.repository Java package to find repository classes that need to be made available as
Spring beans for use by SDN:
<neo4j:repositories base-package=
"com.manning.neo4jia.chapter09.simple.repository"/>
You'd replace the package name with the location where your specific repository imple-
mentations live. The package element defines the base-package (or packages) to search
through to find repositories.
Additional Spring Data Commons Configuration Options
SDN is built on top of the infrastructure and libraries provided by the Spring Data Com-
mons project. The additional configuration options made available via SD Commons
should also work here.
How does Spring know where to find the XML configuration file?
The short answer is that you need to tell it, but this will generally depend on what kind of
application you are creating.
If you're building a web application, the Spring Web framework provides a custom Con-
textLoaderListener class that you can use within your web.xml file to create the
container, as shown in the following snippet. Note that in this case, the XML configuration
file (applicationContext.xml) is referred to from its location within the WEB-INF direct-
ory:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>
Search WWH ::




Custom Search