We have a plain java web project with some servlets, some JPAs and our logic.
我们有一个普通的java web项目,包含一些servlet,一些JPA和我们的逻辑。
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.
我们希望迁移到Cloud Foundry。我已经了解到,Spring启动提供了很多很好的云代工厂功能,例如支持CF环境变量解析,CF服务代理API实现。
Now i don't want to move to Spring MVC since we already have the application running with plain java web framework.
现在我不想转移到Spring MVC,因为我们已经有了使用普通java web框架运行的应用程序。
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.
我是否仍然可以使用Spring Cloud Foundry相关项目来利用Cloud Foundry相关功能,例如解析env变量?他们内部依赖于Spring核心,spring mvc项目吗?由于所有内部弹簧依赖性,包括Spring Cloud Foundry项目将包括我的总可部署战争规模。
Best Regards,
Saurav
1 个解决方案
#1
0
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.
这很大程度上取决于您想要使用哪些功能。你从Spring Boot获得的真棒需要Spring,所以除非你拥抱和使用Spring,否则它不会转移到你的应用程序。 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.
您特别提到了从环境变量解析服务信息(即VCAP_SERVICES和VCAP_APPLICATION)。这是我想到的一个例外。没有Spring,您可以在有限的容量内使用Spring Cloud Connectors。请参阅此链接了解详情。它不像你使用Spring和Spring Boot那样功能齐全,但它会给你一些帮助。
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.
如果您不想使用SCC,您始终可以自己解析环境变量并使用数据。这在概念上非常简单。 VCAP_APPLICATION和VCAP_SERVICES都是环境变量,值是JSON blob,因此您需要做的就是解析JSON并找到所需的信息。
Hope that helps!
希望有所帮助!