Can i use Spring Webflow/MVC and Spring Security and Hibernate on Google App Engine?
Is there a list/summary of java frameworks that can be used on the GAE?
Will it Play In Java lists frameworks, languages and libraries that work (or not) in Google App Engine. At present, the information listed is:
Spring MVC
Version 2.5.6
Status COMPATIBLE
To see Spring's MVC framework running on App Engine, check out the autoshoppe sample application. If you're using Spring forms (e.g. using the spring-form.tld tag library and subclassing SimpleFormController), you will need to register custom editors for your properties. This is covered in http://groups.google.com/group/google-appengine-java/browse_thread/thread/d93fd7385bf85bf7.
Spring ORM
Version 2.5.6
Status COMPATIBLE
To get Spring working with the App Engine-provided JPA interface, follow the instructions at http://objectuser.wordpress.com/2009/05/19/spring-jpa-in-google-app-engine/, which discusses a workaround to the dependency on javax.naming needed for #PersistenceContext. A more complex workaround is available at http://groups.google.com/group/google-appengine-java/browse_thread/thread/187d41712ec1d394.
Spring Security
Version(s) ?
Status SEMI-COMPATIBLE
To work around a ClassNotFoundException, you can use a re-compiled version of the library which adds a StringInsensitiveComparator class -- the download is provided at http://www.google-app-engine.com/blog/post/Spring-security-fix-for-google-app-engine.aspx. See http://www.dotnetguru2.org/bmarchesson/index.php?p=1100 for tips on how to get Spring Security running with App Engine and GWT (in French). See http://groups.google.com/group/google-appengine-java/browse_thread/thread/964e7f5e42840d9c for discussion on the integration.
Hibernate
Versions All
Status INCOMPATIBLE
You cannot currently use Hibernate directly. The differences between the App Engine datastore and SQL were too great to get the standard Hibernate up and running under App Engine. App Engine does support JDO and JPA, so you may be able to convert your Hibernate code to use one of these ORM interfaces.
I suppose that it should work with Spring 3.0 too, I will try soon and share the results.
UPDATE: I tried a Spring MVC Hello World with Spring 3.0.6 with Google App Engine and it worked perfectly, both locally and in the cloud. The drawback though, is longer load time when a new instance starts.
As far as I know, no third party libraries are supported (at least none are listed), and JRE classes are limited to this list. But I guess if a library only makes use of the listed jre classes, they should be fine. However, finding out if they do would have to be based on trying it out.
Related
i´m currently working on a Spring Boot jar library for reuseable components like
ldap
email
messaging with apache kafka
rest api usage
Aim:
Every Java "user/coder" of our company should be able to "put" this jar in ones project (by maven or whatever) and use the reusable components instead of coding all things by hand over and over again.
Building microservices for that issue over REST is not an alternative to us.
My question is:
Can i reuse this Spring Boot jar library in any plain Java projects?
Beeing fond, can i "put" this jar library into a Java project and wire my Spring Boot services from that library in my "non Spring Boot" vanilla Java project?
Notice / Edited:
I have used Spring Boot as project template (spring-boot-starter-parent).
I configure my templates like the LdapTemplate by hand and don´t let Spring Boot do the magic.
Edit
As far as the reuse in Spring Boot/Spring projects is concerned, everything is fine. I´ve done that already.
My aim with that library may be that every Java "user" can use this library, like so:
final SuperCoolLibary scl = new SuperCoolLibrary();
final boolean exists = scl.searchForLdapUser("tlang");
So another question maybe:
Would it be better do switch this library to maybe the new Java Jigsaw module infrastructure?
Write your own Spring-Boot-Auto-Starter. A guide can be found under: https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-developing-auto-configuration.html
This way your library can be used in every spring boot project by just adding it as dependency (which means the jar must be in your classpath).
If your Java Application does not use the SpringContext the services cannot be "wired" by spring into your plain vanilla java application.
I am migrating from PlayFramework 1.* (java) to SpringMVC (but not using SpringBoot). I have some questions about the transition:
1) In Play framework there is an opportunity to show an error in a browser, when you deploy an app in dev mode. As I understood in Spring there is nothing like that, but I always see error pages with 500 http code when errors occur. That is no good for users to see those exception logs. In Play it is easy to stop showing those messages to users by switching to prod mode, but how to do that in Spring? (I deploy the webapp to tomcat7).
2) Is there any way in SpringMVC to get a path to any controller as it can be done in Play's template engine with #{Controller.action} tag? In Spring I use JSP for rendering web pages.
3) In examples of Play projects I saw before, properties like URLs of external resources or some texts are stored in .conf files that are divided into development.conf, production.conf etc. Play loads them (not automatically hough) depending on which server is running the application. Is there a way to create and load such kinds of property files in Spring and make it easier to switch between those configurations on different servers?
If you are new to web programming and Spring MVC and Play I wouldn't start learning with the combination of Play and Spring. I recommend start either with Spring or with Play. Nearly everything you can do with Spring MVC you can do with Play itself too and if it is dependency injection you are after then Play comes with Guice out of the box.
For Spring I'd recommend starting with Spring Boot (and MVC of course). There is a good tutorial on their site.
For Play I'd recommend their official documentation. You could also look at Lightbend's templates and filter for Java, e.g. this one seems to be a good starting point for a simple web app.
I want to use spring 4 with minimal xml configuration for the now new project I am about to develop. I will be using Spring in this project for dependency-injection, mvc, security and jdbc. I will use JOOQ for query generation. (Yes, I need to project to support Postgresql and oracle) (maybe, in future, this app will extended support for REST too). The problem I face now is my production application server is JBoss5.1.0.GA, which obviously does not support servlet 3.0. Now I have a working spring 4 mvc code base with servlet 2.5, but I could not figure out how to configure the security with java config. Because I see most of the examples on spring 4 on servlet 3.0+ versions, and very less not good examples on 2.5. Though I read the spring security from the spring website, it made little difference on implementing it. Have anyone implemented security (db/ldap) on servlet 2.5? Share with me your wisdom and experiences.
Spring security (I suppose version 3.2 as you speak of spring 4) works well on servlet 2.5, at least with xml config. I am not sure that you can use full java config for security, but I am sure annotations can be used for method security.
I followed this NetBeans guide here on RESTful web services using JPA - http://netbeans.org/kb/docs/websvc/rest.html
I thought JPA was supposed to be a specification and you would use something like Hibernate as the actual implementation in your application. But this guide doesn't make any mention of an implementation at all. So where is the implementation coming from, is NetBeans providing its own JPA implementation?
That tutorial uses Glassfish as the Application Server. It provides the implementations for the JavaEE Apis, and in the case of JPA, it is EclipseLink. The idea is that your application does not ship with those libraries (JARs) and instead rely on the ones provided by the Application Server
Once you have it working, if you wish to learn about different JPA implementations, or different Application Servers, then you can try running the same application on JBoss, which has Hibernate as its JPA implementation.
Presumably it is the JPA provided by the container (probably Glassfish).
I need to start developing applications using the Spring framework, and am wondering what tools I need to download to have me up and running.
On the SpringSource website I am seeing all these applications to download and I am wondering, do I really need all this? And what versions should I use, especially for Spring Framework?
Spring Framework
SpringSource dm Server Samples
Spring Security
Spring Web Flow
Spring Web Services
Spring Dynamic Modules
Spring Integration
Spring Batch
Spring.NET
Spring JavaConfig
Spring LDAP
Spring Extensions
Spring IDE
Spring BlazeDS Integration
SpringSource Bundlor
Spring ROO
What other applications do I need to download (eg. Struts, Glassfish, Apache, etc.)?
This depends on what you want to use Spring for. Typically that's Web applications. If so you only need two things:
Spring framework (with minimal dependencies); and
A servlet container (eg Tomcat) or a full-blown application server (eg Glassfish, JBoss).
Everything else is optional. I believe the only required dependency is Apache Commons logging. Depending on what features you use, you may well need more.
If so, here is a [tutorial][1] that creates a barebones Spring MVC project. There are countless others around for that and other topics.
It's entirely possible to use Spring in, say, a Swing application in which case you obviously don't need a servlet container.
All you need from SpringSource is the Spring Framework.
Spring 3.0 is on the way, but for now, use 2.5.6.SEC01, the current production release.
You can get started with a simple servlet container (ie: Tomcat) rather than a full blown application server (eg: JBoss, Glassfish).
The Spring Framework comes bundled with jars for web development - ie: spring-web and spring-webmvc.
See #117535 for a simple example of using Spring MVC.
It mainly dependent on what you need Spring for. Each and every piece of Spring can, actually, be used in separation from the rest. You may use it only for IOC, in this case you don't need, for example, MVC and Servlets, etc...
The easiest way to start is to dowload the main package from http://www.springsource.com/download/community?project=Spring%20Framework
You can use Spring from any IDE
The best way is to use Maven with your project. Basically all you have to do is edit your pom.xml file and tell it that you want to use Spring. Then when you compile your code, Maven will go out and automatically download the Spring libraries you need from their public repository.
Here's an example:
http://pookey.co.uk/blog/archives/63-Getting-started-with-Maven-and-Spring.html