简体   繁体   English

12 因素应用程序 - 依赖泄漏

[英]12 factor application - dependency leak in

Been going through the 12-factor application manifest, Under the section of "Dependencies" following is mentioned.浏览了12-factor应用程序清单,在下面的“依赖项”部分中提到了。

A twelve-factor app never relies on implicit existence of system-wide packages.十二要素应用程序从不依赖于系统范围包的隐式存在。 It declares all dependencies, completely and exactly, via a dependency declaration manifest.它通过依赖项声明清单完整且准确地声明所有依赖项。 Furthermore, it uses a dependency isolation tool during execution to ensure that no implicit dependencies “leak in” from the surrounding system.此外,它在执行期间使用依赖隔离工具来确保没有隐式依赖从周围系统“泄漏”。 The full and explicit dependency specification is applied uniformly to both production and development.完整和显式的依赖规范统一应用于生产和开发。

In the context of Spring boot application, the following is my understanding.在 Spring boot 应用程序的上下文中,以下是我的理解。

  1. Using any build tool (such as maven/gradle)使用任何构建工具(例如 maven/gradle)
  2. declare all dependencies in pom.xml or build.gradle.在 pom.xml 或 build.gradle 中声明所有依赖项。

Is this a correct understanding?这是正确的理解吗? I can't understand the part of "Leak In" from the surrounding system.我无法理解周围系统中“泄漏”的部分。

Does this mean that the JVM should also be within the application?这是否意味着 JVM 也应该在应用程序中?

I am not a SpringBoot person.我不是 SpringBoot 人。

Imagine that, a SpringBoot application requires n number of environment variables of which your application has set p number of variables.想象一下,一个 SpringBoot 应用程序需要n个环境变量,您的应用程序已经设置了p个变量。 A 12 factor application should not assume that the remaining np environment variables are already set in the OS. 12 因子应用程序不应假设剩余的np环境变量已在操作系统中设置。 In fact, if they were set at an OS level, then those environment variables leak in to your application which may have unexpected results.事实上,如果它们是在操作系统级别设置的,那么这些环境变量会泄漏到您的应用程序中,这可能会产生意想不到的结果。 For example, heap memory was set at an OS level to a value that is not 'correct' for your application.例如,在操作系统级别将堆内存设置为对于您的应用程序不“正确”的值。 So, rather than assume a 'generous' setting of heap memory at OS level, your application sets it up explicitly.因此,您的应用程序不会在操作系统级别假设堆内存的“慷慨”设置,而是明确设置它。

This is a good factor to consider, IMHO.恕我直言,这是一个值得考虑的好因素。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM