-
Jul 19th, 2012, 11:50 PM
#1
I need your feedback please - project based or package based
Good Day All,
First of all thanks goes to the spring framework folks
for providing an excellent framework and then thanks to
the community.
I am here today after a friend of mine, who works in
the same place that i do, suggested for me to make a
"modular project" with spring and hibernate.
Naturally that was a good piece of advise and i started
off with making a package structure
com.company.product.bean, ...dao , ...dao.impl,
...service, ...service.impl, ...web for mvc
controllers. All this in the src folder and unit tests
in the test folder.
I told him this but he said he doesnt think this is
modular. he said separate domain level project (with
beans and daos) and separate service project and
separate web project. He also said we call the services
initializing them with "new". He says that is more
modular. Our project size is small now with the first
phase rolling out with only 1 dao class and 2 service
classes.
To me I did it and tried to make spring work with its
instantiation of objects by itself without the "new"
but it didnt work. I believe that the object
instantiation should be left over to spring and we dont
use "new" for the services and daos that it is
managing. Otherwise we are not really "using" spring at
its core dependency injection.
I brought everything in one project and things started
running smoothly with making the project modular by
adding that package structure referred to earlier. My
thinking stems from what sun or oracle folks say here
http://docs.oracle.com/javase/tutorial/java/concepts/pa
ckage.html "Because software written in the Java
programming language can be composed of hundreds or
thousands of individual classes, it makes sense to keep
things organized by placing related classes and
interfaces into packages."
Anyway to make this short, i am willing to go the
separate project route but i want to know why now
because the project is small now, we expect the project
to grow but its one dao class now, then it might be
three. well please provide your feedback on package
structure vs project structure and can we refactor
later in the future.?
Thanks
Last edited by mba; Jul 19th, 2012 at 11:54 PM.
-
Jul 20th, 2012, 01:16 AM
#2
Why should it be the one or the other? You can perfectlyl do both, what is wrong with that? Also if it is small it might be overkill to create several projects. Next to that I probably wouldn't create modulair application that way, I would scope them in more or less functional/business domains (user management, inventory, shopping cart) instead of technical (data, service, web etc.). The web layer can be difficult because you might have 1 single end -user application which needs several different backend modules/applications, depending on the amount of flexibility that can be a challenge.
-
Jul 20th, 2012, 02:19 AM
#3
When i go the multiple project route i get this error
org.springframework.beans.factory.NoSuchBeanDefini tionException: No matching bean of type [com.ces.intelliops.service.impl.AllCrudOperationsS erviceImpl] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Aut owired(required=true)}
-
Jul 20th, 2012, 02:50 AM
#4
Which indicates 2 things
1. A problem with your setup/configuration
2. You aren't programming to interfaces but concrete classes...
-
Jul 20th, 2012, 02:58 AM
#5
yes you are right. the programming to interfaces was the issue. now web-> service is configured . but the service -> daos is left .. lets see
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules