Using Spring Cloud Foundry project with a plain java web project - spring-mvc

We have a plain java web project with some servlets, some JPAs and our logic.
We want to move to Cloud Foundry . I have learnt that Spring boot comes up with a lot of nice cloud foundry features out of the box like support for CF environment variables parsing, CF service broker API implementation.
Now i don't want to move to Spring MVC since we already have the application running with plain java web framework.
Can i still use Spring cloud foundry related projects to take advantage of Cloud Foundry related features like parsing of env variables ?
Are they internally dependent on Spring core, spring mvc projects ? Will including the Spring Cloud Foundry project bloat my total deployable war size due to all internal spring dependencies.
Best Regards,
Saurav

A lot of this depends on exactly which features you want to use. The awesomeness you get from Spring Boot requires Spring & so it won't transfer to your app unless you embrace & use Spring. The same goes for Spring Cloud.
You specifically mentioned parsing service information from environment variables (i.e. VCAP_SERVICES & VCAP_APPLICATION). This is the one exception that comes to mind. You can use Spring Cloud Connectors in a limited capacity without Spring. See this link for details. It's not as full-featured as what you'd get if you were using Spring & Spring Boot, but it will give you some help.
If you don't want to use SCC, you can always parse the environment variables yourself and use the data. It's conceptually very easy. Both VCAP_APPLICATION & VCAP_SERVICES are environment variables and the value is a JSON blob so all you need to do is parse the JSON and locate the information that you need.
Hope that helps!

Related

Is there an equivalent of Spring Cloud Stream in .Net or .Net Core?

I have a Java project that needs to be rewritten in C# .Net Core. The Java app is currently deployed on cloud using SCS. The concept of stream looks smooth as we can easily visualize the flow of data there. It would be nice to have something similar available in .Net/Core. I tried Google, but couldn't get any useful info on this.
Steeltoe Stream Support:
https://github.com/SteeltoeOSS/steeltoe/issues/128
https://docs.steeltoe.io/articles/releases/steeltoe-3-1-minor-release-major-deal.html
This is an Epic, that will track all the work being done for our Streams feature.
Steeltoe Streams will be similar to the functionality that Spring Streams brings. Steeltoe Streams will be used for building highly scalable event-driven .NET microservices connected with shared messaging systems.
Steeltoe OSS: Cloud Native .NET Applications - Friend of Spring Boot and Spring Cloud.
Developed by WMware / Pivotal - https://hub.docker.com/u/steeltoeoss/

Struts migration to Spring MVC - via Spring Boot

We are in the initial stages of converting a Struts 1.2.9 application to Spring MVC. While the impact has been analyzed and well documented and understood for this migration, we are uncertain if we should introduce Spring Boot in this equation.
I have been reading other threads and would like to state that we are not looking to integrate Struts with Spring - rather we are for sure migrating and moving out of Struts to Spring MVC.
Given this background, invite suggestions/thoughts around below:
Benefit of introducing Spring Boot in this process is more of a distant one of an eventual move to Cloud. As such the team has completed the initial configuration required for a Spring application (like web.xml, required jars, spring-servlet.xml) and not sure of immediate benefits for us.
In case we decide to use Spring Boot in this process, we perceive the impact to be:
i. Add spring-boot-starter-web to our gradle build.
ii. Create a starter Application class
iii. Revisit configurations in web.xml like startup servlets using 'SpringBootServletInitializer'
iv. Continue to use a war based traditional deployment using gradle war plugin. Does this package the spring based libraries into the war or should the libraries be on the server classpath?
I welcome thoughts/suggestions/rejections of this as an approach itself :).

STS & Spring Integration multiple xml files and merged Integration Graph

I am working on a project using spring integration. I am using XML because I like the visualization of integration flow using Integration-Graph in STS. But because of reusing components and reorganisation flows in subflows in separate xml files, I would like to have a merged view in the graph.
As I remember the Spring Bean Graph it was possible to select configuration files as package for visualisations.
Is there a functionality for Integration, too?
While that feature is not available in STS, we are working on a runtime visualization of a running Spring Integration application. Since 4.3, Spring Integration (when running in a web container or as a Spring Boot application with web support), can expose the runtime environment as JSON see documentation here.
The spring-flo project has a sample (it's still a work-in-process) for visualizing the flow.
The application used in the readme is the the file-split-ftp sample application. Notice the required CORS bean definition (which will be made simpler in the next release).

Spring MVC or Spring Boot [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
For a large company (web) project, do you recommend using Spring MVC or Spring-Boot?
Spring-Boot, in terms of configuration, is very easy compared to Spring MVC.
I wonder if I use Spring-Boot can have the same advantages of Spring MVC?
What do you recommend?
My personal advice is to definitely use Spring Boot for many reasons.
The first is that Boot is the "future of Spring". That means that with Boot
you can benefit from many commitments of the Spring community. Most of the
Spring projects today are completely
integrated with Boot, even the community starts to develop many
applications based on Boot. For example for managing and monitoring.
I can suggest to see Spring Boot Admin
With Spring Boot you can benefit from very nice and useful features such as
actuator and remote shell for managing and monitoring, that
improves your application with production ready features that are very
useful.
Very nice and powerful properties and configuration controls - you
can configure your application with application.properties/yml
and extend the boot in a very simple and impressive way, even the
management in terms of overriding is very powerful.
It is one of the first micro-service ready platforms, and in my opinion
nowadays it is the best! Even if you don't build a micro-service
project with boot you can benefit of using a modern approach in which
you have a auto-consistent jar that can benefit from all the features
that I described above or if you prefer you can impose the packaging
as a classical war and deploy your war in any of the containers that
you want.
Use of an intelligent and convention over configuration approach that
reduces the startup and configuration phase of your
project significantly. In fact you have a set of starter Maven or Gradle dependencies
that simplify the dependency management. Then with the
auto-configuration characteristic you can benefit from a lot of
standard configurations, that are introduced through the Conditional Configuration framework
in Spring 4. You can override it with your specific
configurations just defining your bean according with the
convention that you can see in the auto-configure JAR of the Boot
dependency. Remember that Spring is open-source and you can see the code. Also the documentation in my opinion is good.
Spring initializer is a cool tool attainable at this link:
https://start.spring.io/ is a very cool tool just to create your project in a very fast way.
I hope that this reflection can help you decide what is the best solution.
Spring Boot uses Spring MVC! It's just autoconfigured and ready to use when you import the spring-boot-starter-web jar. So you'd basically are talking about whether to use Spring Boot or manually setup your Spring Application...
You can definitely go for Spring Boot. We have already started using Spring Boot for building enterprise application. It has lot of advantages, listing few below here:
Your project configuration will be pretty simple. No need to maintain XML file, all you need to know is how efficiently you can use application.properties file.
Gives lot of default implementation, for instance if you need to send an email, it provides default implementation of JavaMailSender
Spring Hibernate and JPA integration will be pretty simple.
Like this there are many, you can explore based on your needs.
You can use Spring MVC with spring boot as #kryger said, they are non exclusive between them, and the configuration will be easier, also I recommend you to use http://www.thymeleaf.org/ which is template framework. Working with that is like working with JSP but thymeleaf integrates seamlessly with HTML, so your code will look very clean and you can add a lot of useful features.
I think Spring Boot is more useful than the MVC, as it has many advantages and inbuilt features which make it more reliable than MVC. In Spring Boot most of the things are auto configured and there is no need of writing those xml as we do in the MVC, which can save time.
Spring Boot bundles a war file with server run-time like Tomcat. This allows easy distribution and deployment of web applications. As the industry is moving towards container based deployments, Spring Boot is useful in this context as well.
Spring MVC is web application framework. While you can do everything in Spring without Spring Boot, but Spring Boot helps you get things done faster.
Spring boot simplifies your Spring dependencies, no more version collisions,
can be run straight from a command line without an application container,
build more with less code - no need for XML, not even web.xml, auto-configuration, useful tools for running in production, database initialization, environment specific config files, collecting metrics.
Basics of Spring Boot can be found here

How to implement authentication and authorization for Spring #MVC 3.0 REST application

I have been implemented my "skeleton" as Spring #MVC 3.0 REST application. Then can anyone please specify me to, how can I perform authentication and authorization with Spring Security, for my stub (client) applications. Thanks.
Your best bet would be looking at the spring security tutorial app which is located in the spring security distribution jar.
From the documentation:
Download the latest Spring Security distribution and unzip the file. After unzipping Spring Security, you'll need to unzip the spring-security-sample-tutorial-3.0.x.war file that you'll find in there, because we need some files that are included within it. After unzipping the war file, you will see a folder called spring-security-samples-tutorial-3.0.x (where "x" is the minor version number).
You can download it here.
Also have a look at the pet clinic security tutorial.
A quick security setup for technology exploration purposes should take around 30 minutes.

Resources