-
Notifications
You must be signed in to change notification settings - Fork 1
2 Project Structure
The project is a combined AngularJS and Spring MVC application.
The project is structured as a Maven project, and can be built by Maven command line.
The AngularJS web site files (js, html, css, etc.) is located at src/main/webapp
.
bower.json
defines all JavaScript dependencies for the JavaScript application
code and the dependencies added to this file will automatically be reflected in
index.html (in src/main/webapp) and karma.conf.js
in the bower:js
and
bower:css
sections if you are using Eclipse
or executing
mvn copy-resources
.
Gruntfile.js
is the Grunt build file.
karma.conf.js
and karma.ci.conf.js
is JavaScript unittest
configuration files (karma.ci.conf.js
is for the CI server only).
package.json
defines all JavaScript dependencies needed to build the
JavaScript application code.
The application is based on a single page AngularJS web site consisting of a number of views each using a number of components.
The views are located at src/main/webapp/views
and the components are located
at src/main/webapp/components
.
The main page is located at src/main/webapp/index.html
.
The Java code is located at src/main/java
(the Java test code is located at src/test/java
).
This Java package contains all the Spring MVC controllers hosting the REST services. Each controller must be annotated with @RestController and the serving methods must be annotated with @RequestMapping annotations. If the controller depends on a repository (fancy name for DAO), then the dependencies are injected using @Autowired annotations.
This Java package contains all the DAO related classes. Repository classes are annotated with the @Repository annotation to be injectable into to another managed class. Filter classes are meant as reusable components for the different search services.
The Java package contains all the entity classes.
The configuration files is located at src/main/resources
and src/main/webapp/WEB-INF
(the test configuration files is located at src/test/resources
).
The Spring configuration file is located at src/main/webapp/WEB-INF/spring-mvc-config.xml
.
The following is configured:
- Enable static file serving (such as js, css and html).
- Enable component scan for the
eea.eprtr.controller
andeea.eprtr.dao
packages so that classes annotated with @Component and descendants (@RestController, @Repository, etc.) will be auto-discovered and be part of the configuration. - Enable JPA with Hibernate as the persistence provider
- Initializing the jdbc datasource from jndi using the name
jdbc/datasource
(which requires that a data source has been configured in the server.xml or context.xml for the tomcat server instance).
The JPA configuration file is located at src/main/resources/META-INF/persistence.xml
.
The following is configured:
- exclude-unlisted-classes is set to false meaning that all entity classes will be auto-discovered using annotations.
- Second level cache has been enabled with EhCache as the provider.
- All other configuration parameters is done using annotations on the entity classes.
The database-mapping.xml
configuration file (located at src/main/resources/META-INF
) defines the schema etc. to use when generating native queries (from JPA queries).
The persistence-test.xml
configuration file (located at src/main/resources/META-INF
) is used for the unit tests and should not be moved (the reason being that JPA requires that the persistence configuration file located in the same jar file as the persistence classes).