Reputation: 1639
I am trying to create a Java Web Application using Eclipse, and my Web Server is Weblogic-12c.
Since I'm new to Java EE technologies, I wanted to find out what kind of folder structure I need to create that follows industry practice and is easy to deploy.
I did a little research on this subject, and most of the oracle examples state to:
However, I would like to avoid the EJB layer but still like to keep my business logic in a separate project. So what kind of project should I create in Eclipse that will hold my business logic classes?
Following are a few more questions:
I intend to use Spring 3.1 MVC. Should I include the Spring framework JARs under the WEB-INF folder, or should I add a reference in the project library?
If I want to add some library(JARs), which will be common to both projects, (Web-App & Business-Logic) where should I put these JARs?
Upvotes: 3
Views: 6606
Reputation: 347
We at ATOCONN usually follows the following project structure for well architect product development & Ease of maintenance. It may be different from project to project base on requirements & design patter you are using.
Our Src Folder For aem (ATOCONN ENTERPRISE MANAGEMENT) product
com.atoconn.aem.beans // This usually containts all beans
com.atoconn.aem.controllers //All controllers will goes here.
|com.atoconn.aem.controllers.finance
|com.atoconn.aem.controllers.projects
|....
com.atoconn.aem.services // All service layer related thing here.
com.atoconn.aem.dao //All database related classes will goes here
com.atoconn.aem.util // All utility classes here
Upvotes: 0
Reputation: 38163
When you say you want to avoid the EJB layer, but still put your business logic in a separate project, then this is a little confusing. In Java EE, business logic is best expressed by EJB beans, and if you want to have those in a separate project then the structure you described is the standard one.
Note that In Weblogic-12c (and every Java EE 6 application server) you can simply put the EJB-based business logic inside the WAR, in a separate package for instance. There is no need to have them in a separate project.
If you meant that you want to use plain Java classes for your business logic instead of EJB, you might want to think twice. Especially when working with databases (JPA) EJBs take a lot of chores away from you. In modern Java EE, they are definitely not something you should actively seek to avoid. In most cases, an EJB bean is as simple to program as a plain Java class. You only add a single annotations (mostly @Stateless) and that's it.
If you want to have libraries that are common to both projects, then EAR/lib is the default mechanism. Every jar you put there will be available to both the Web project and the EJB project.
Additionally, if you're using Weblogic-12c, note that it already comes with an MVC framework (JSF 2) that is really good and can be used right away. You thus don't necessarily have to add this yourself.
Upvotes: 6