kjpradeep
kjpradeep

Reputation: 27

Spring MVC Project(s) setup in Eclipse - separate base packages and web and rest apis

I am working towards building a Spring MVC based Web application project along with rest API for the same to work with mobile Apps.

For this i am trying to setup the project structure in Eclipse as the following.

  1. Base Project with the following packages

    • mydomain.myapp.constants
    • mydomain.myapp.dao
    • mydomain.myapp.services
    • mydomain.myapp.util
  2. Web App Project with the following packages

    • mydomain.myapp.config
    • mydomain.myapp.controller
  3. Restful Services project ( not started yet)

I have added the base project as a dependency for web app project. The build is NOT working after putting in some dao, model ,service , controller, views to start with.

it is giving below errors

Note: I am using Maven Archetype https://javalibs.com/archetype/fr.uha.ensisa.ff/spring-mvc-archetype

Upvotes: 0

Views: 214

Answers (2)

kjpradeep
kjpradeep

Reputation: 27

Got the root-cause for my problem. The order of projects for export/build in Deployment Assembly was having the dependency/base project at the bottom of the list. Once i moved it to the top things started working. Thanks everyone for the support.

Upvotes: 1

Zeusox
Zeusox

Reputation: 8448

This usually happens whenever you have a class file that your program relies on and it is found at compile time, but unfound at runtime. Try to check out your build time and runtime classpaths to see if there are any differences.

The other thing to try is try to declare the following in your main application class:

    @ComponentScan("org.example.base")
    @EntityScan("declare.base.package")
    @EnableJpaRepositories("declare.dao.package")

Upvotes: 0

Related Questions