Need help in deciding java framework, libraries

2019-08-03 23:48发布

问题:

I am planning to develop open source java application to work on google app engine as well as normal rdbms system, so please help me in choosing

MVC Framework - Struts / Spring MVC ?

ORM - JDO / JPA ?

I am considering performance as a key factor.

回答1:

For app engine you will want a lightweight framework, both for persistance and application stuff. Google is changing their pricing model so you might want to consider how this will impact your plans as well. There is an interesting discussion on the app engine group about this: https://groups.google.com/forum/#!topic/google-appengine/ob-kMuDAAqc/discussion

Aside from that I can only comment on the choice of persistance framework:

JDO on app engine is a pain. The version they (Google) support in app engine is 1.x, which is ancient, I believe. I have had more trouble with getting things to work than I care to remember. If you have previous experience with JDO this still might be a good choice. If I were to start over again I would choose a persistence framework that was specifically written for app engine, like objectify or twig. They require less overhead and are easier to use (from my point of view). One giant plus of objectify: gives you memcache support out of the box with no extra work. How great is that?

However, you also want to support an RDBMS. If you have the time, you could roll your own abstraction layer on top of objectify and the RDBMS persistance layer of your choice. That would give you the edge in performance that you are looking for. ;)

If that is not an option I would suggest JPA (not because I have used it myself, but because I had so much trouble with JDO).

Hope this helps!



回答2:

What do you mean by performance? For instance, if you're not using the always on feature, you might consider the server cold start-up time as the single thing affecting the performance the most. All the frameworks will make it slower, there's even a blog post about optimizing the cold start-up time.

For the MVC, Spring 3 is quite good at it, but it's more personal preference and what you're comfortable with. If you want something designed for AppEngine, give Gaelyk a try, it's Groovy though. For the data storage, JPA is perhaps more widely used, but I think the JDO support on App Engine is better. Both of those provide some level of platform independence, if you need to get off from App Engine. There are also Objectify-Appengine and Twig that are more tied to the platform and thus might provide better interface for managing the datastore.



回答3:

I would personally go with Java EE 6 framework.So

MVC: JSF -> very lightweight and easy to develop. JSF2.x fixed many shortcoming features from JSF1.2 ORM: JPA2.0 -> since it is standard and come with Java EE 6 bundle. You can replace with Hibernate, your choice. Each has its own unique advantage features. I would not say one is better than other. Dont forget that Java EE 6 come with EJB3.1. EJB have had its bad reputation to be heavyweight, however since EJB 3.0, it is a much different story. EJB3.1 has become much more light weight and easy to develop. Glassfish web profile provides EJBLite (Hehehehe :D :D much lighter :D)

In term of development complexity, I have to say that Spring is a bit more complex than JEE6, but again, I only touch Spring very minimal, this discussion will leave to much more experienced developers to talk about.



回答4:

I would go for JSF + JPA and I'd use Spring Framework for dependency injection.

My 5¢. :P