Database Reference
In-Depth Information
<!-- used to check login before accessing certain pages -->
<mvc:interceptors>
<mvc:interceptor>
<mvc:mapping path="/social/**" />
<mvc:mapping path="/user/**" />
<mvc:mapping path="/interest/**" />
<mvc:mapping path="/consumption/**" />
<mvc:mapping path="/location/**" />
<mvc:mapping path="/intent/**" />
<bean class="com.practicalneo4j.graphstory.interceptor.SecurityInterceptor" />
</mvc:interceptor>
</mvc:interceptors>
<!-- get properties for use in the configuration -->
<bean id="projectPropertyConfigurer" class="org.springframework.beans.factory.config.
PropertyPlaceholderConfigurer">
<property name="location">
<value>classpath:/com/practicalneo4j/graphstory/service/package.properties</value>
</property>
</bean>
<!-- mustache.java -->
<bean id="viewResolver" class="com.practicalneo4j.graphstory.util.NMustacheViewResolver">
<property name="cache" value="false" />
<property name="templateFactory">
<bean class="com.practicalneo4j.graphstory.util.NMustacheJTemplateFactory" />
</property>
</bean>
<!-- DB Connection to Neo4j server -->
<bean id="graphDatabaseService" class="org.springframework.data.neo4j.rest.
SpringRestGraphDatabase" scope="singleton">
<constructor-arg value="${rootNeo4jServiceUrl}/db/data" index="0"/>
<constructor-arg value="${username}" index="1"/>
<constructor-arg value="${password}" index="2"/>
<!-- domain entity classes -->
<neo4j:config graphDatabaseService="graphDatabaseService" base-package="com.practicalneo4j.
graphstory.domain"/>
<!-- Package repositories -->
<neo4j:repositories base-package="com.practicalneo4j.graphstory.repository" />
<tx:annotation-driven mode="proxy"/>
</beans>
Next, the configuration applies
context
and
mvc
specific settings, such as the package location of the
application's controllers. The
MCV
bean also sets the location for static assets, such as CSS, JavaScript, and images that
are used within the application. The
mvc:interceptors
reference can be used before each request to run specific
code prior to completing the request, such as check if a user is logged in before accessing certain pages in certain
paths. Following the interceptor, the
projectPropertyConfigurer
supplies the location for application properties,
and the
viewResolver
bean handles the integration with the Mustache templating language.