Skip to Content
/wp-content/uploads/2014/12/spring_cloud_logo_607206.png

Prologue

For all the Java developers out there Spring (or Spring framework to be more precise) does not need any further introduction, as it is among the most popular frameworks within the Java space. What started out as a simpler, more lightweight and more intuitive alternative to the official EJB standard back in the times quickly became the de-facto standard for developing modern Java-based enterprise applications. A big part of this success can safely be attributed to the smooth interplay between Spring and numerous other open-source frameworks for every aspect of a typical applications. From the underlying ORM (Object-relational mapping) framework to be used for persistence up to the frontend layer Spring allows developers to choose their framework or implementation of choice and develop using the well-designed abstraction layers provided by Spring. This flexibility plus the outstanding (!!!) documentation are the cornerstones of Spring success.

Spring Cloud Connectors

One of the more recent additions to the Spring lineup are the Spring Cloud projects, which aim to simplify the development of cloud applications by providing “tools for developers to quickly build some of the common patterns in distributed systems.” Within this umbrella there’s a particularly interesting project called Spring Cloud Connectors:

“Spring Cloud Connectors simplifies connecting to services and gaining operating environment awareness in cloud platforms like Cloud Foundry and Heroku. Special support for Spring application through Java and XML config makes it trivial for apps to connect to cloud services. Designed for extensibility, you can use one of the existing cloud connectors (Cloud Foundry and Heroku) or write one for your cloud platform. While supporting commonly used services (relational databases, MongoDB, Redis, Rabbit) out of the box, it allows extending it to your own services. Neither of these require modifying Spring Cloud itself; all you need to do is add jars for your extensions to your classpath.”

[Note: Emphasis added by me.]

To summarize the project’s mission statement it’s all about providing sort of an abstraction layer to consume cloud services in a standardized manner, hence making it easier to write applications that can run on multiple cloud platforms (PaaS) without having to worry about specifics of a particular runtime. This approach results in several advantages including a lower entry barrier during onboarding for newbies and a dramatically reduced risk of vendor lock-in.

So far, so good… now the good news is that SAP just released Spring Cloud Connectors for SAP HANA Cloud Platform!

This implies that you can now develop applications that run on both the traditional Java stack of HCP (aka NEO) and a Cloud Foundry runtime using the same codeline! To demonstrate this I’ve provided a simple sample application on github: SAP/cloud-hello-spring-cloud

The screenshots below shows the application running on Cloud Foundry (CF) and the HCP Java runtime (NEO) respectively:

spring_cloud_connectors_CF.jpg  spring_cloud_connectors_NEO.jpg

Please check out this sample and familiarize yourself with Spring Cloud Connectors and how-to use them! We are really interested in getting your feedback!

For further information regarding Spring Cloud Connectors and the original sample application please refer to the following blog posts:

PS: Expect a new blog post in the Enterprise Granny series in that context coming soon as well 🙂

To report this post you need to login first.

9 Comments

You must be Logged on to comment or reply to a post.

  1. Vincenzo Turco

    hi Matthias

    thanks for the great blog! I was wondering if you had had any chance to look into Spring Boot deployment on HCP (EE6). I am going through a weird sequence of LinkageErrors, NoClassDefFound exceptions while doing so. I guess the point is to set the right scope to maven dependencies (compile/provided) to prevent classloading issues. However, to me it looks like a try-and-fail approach. Any experience on how to get Boot to stabilize on HCP would be great!

    thanks a lot, regards

    Vincenzo

    (0) 
    1. Nicola Beghin

      I solved

      Exception sending context destroyed event to listener instance of class org.springframework.web.context.ContextLoaderListener

      java.lang.LinkageError: loader constraint violation: when resolving method “org.slf4j.impl.StaticLoggerBinder.getLoggerFactory()Lorg/slf4j/ILoggerFactory;” the class loader (instance of org/eclipse/osgi/internal/baseadaptor/DefaultClassLoader) of the current class, org/slf4j/LoggerFactory, and the class loader (instance of org/eclipse/osgi/internal/baseadaptor/DefaultClassLoader) for the method’s defining class, org/slf4j/impl/StaticLoggerBinder, have different Class objects for the type org/slf4j/ILoggerFactory used in the signature

      by using “Java EE 6 Web Profile” and latest git clone from GitHub – SAP/cloud-hello-spring-cloud: Simple sample demonstrating the usage of Spring Cloud Connectors

      (0) 
  2. Hamid Ait Brahim

    Hi everyone,

    In my application I’m using spring and deployed it on HCP trial java web 8 when I use @autowire my bean is not injected and is always a null.

    Could anyone help me?

    thanks

    (0) 
  3. Helen Mishra

    hi Everyone,

    We are developing a spring boot application which will be deployed in sap cloud platform(cloud foundry) i want to use the auto configuration feature of the build pack which can set the db properties of hana db.like url ,username and password from VCAP_SERVICES .I am not able to set them using java build pack available.is there a way out?

     

    Help is appreciated.

     

    regrads!

    Helen

    (0) 

Leave a Reply