在Jersey 1.x中,您可以使用ContainerRequest.getFormParameters()对表单数据执行请求筛选,但我没有在Jersey 2.x中看到明显的等效项.我已经实现了ContainerRequestFilter界面,让我可以访问a ContainerRequestContext,但从那里如何获取表单数据?
泽西岛1.x例子:
public class MyFilter implements ContainerRequestFilter {
public ContainerRequest filter(ContainerRequest request) {
Form f = request.getFormParameters();
// examine form data and filter as needed
}
}
Run Code Online (Sandbox Code Playgroud)
泽西岛2.x例子:
public class MyFilter implements ContainerRequestFilter {
public void filter(ContainerRequestContext context) {
// how do I get to the Form data now?
}
}
Run Code Online (Sandbox Code Playgroud) 使用 Spring Boot 2.4.0,我尝试配置spring-boot:build-image任务以将图像推送到我的私有 GitHub 容器注册表。
我使用这些说明来配置我的 POM,如下所示:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<image>
<name>ghcr.io/abc/${project.artifactId}:${project.version}</name>
<publish>true</publish>
</image>
<docker>
<publishRegistry>
<username>abc</username>
<token>mytoken</token>
<url>https://ghcr.io</url>
</publishRegistry>
</docker>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
当我执行spring-boot:build-image任务时,它会构建图像,但当它尝试推送时出现以下错误:
[INFO] Successfully built image 'ghcr.io/abc/def:1.5.0'
[INFO]
[INFO] > Pushing image 'ghcr.io/abc/def:1.5.0' 100%
Execution default-cli of goal org.springframework.boot:spring-boot-maven-plugin:2.4.0:build-image failed: Error response received when pushing image: error parsing HTTP 405 response body: unexpected end of JSON input: "" -> [Help 1]
Run Code Online (Sandbox Code Playgroud)
我可以使用手动推送图像docker push,并且我尝试过这样做docker login也没有帮助。我也没有位于任何防火墙或代理后面。
我有 4 个 Elastic Beanstalk 部署:3 个是 Corretto 8,另一个是 Corretto 11。
在 Corretto 8 部署中,我可以毫无问题地设置新配置。但是,在 Corretto 11 实例上,任何设置新配置的尝试都会失败并导致回滚。
Corretto 版本可能不是问题,但这是我能看到的唯一区别。所有 4 个应用程序都是作为 Web 服务器运行的 Spring Boot 应用程序(即带有公开 Web 端口的嵌入式 tomcat)。我试图设置完全相同的配置名称和值,但它仅在一个实例上失败。
我尝试设置的配置非常简单:
VALIDATE_RENEWALS = true
Run Code Online (Sandbox Code Playgroud)
即使只是尝试设置DEBUG = true也会导致失败和回滚。
我没有从控制台看到很多有关失败的信息。这是事件日志:
2020-03-16 13:55:17 UTC-0600 INFO The environment was reverted to the previous configuration setting.
2020-03-16 13:54:45 UTC-0600 ERROR During an aborted deployment, some instances may have deployed the new application version. To ensure all instances are running the same version, re-deploy …Run Code Online (Sandbox Code Playgroud) 我们在 Kubernetes 集群中有多个使用 Apache Ignite 的应用程序。Ignite 创建各种大小如下的线程池:
Math.max(8, Runtime.getRuntime().availableProcessors())
Run Code Online (Sandbox Code Playgroud)
因此基本上线程池的大小始终至少为 8,但如果系统认为有更多处理器,则可能会更大。
我们遇到的问题是,一些 pod 使用池大小 8 旋转,而其他 pod 使用池大小 36,这是节点上的 CPU 数量。
我们使用 Helm 来部署所有应用程序,但我们没有为任何 pod 设置任何 CPU 限制。理论上,它们都应该看到相同数量的可用 CPU。
还有什么可能导致同一节点上的 Pod 查看可用处理器数量的不同视图?
我们的所有应用程序都有一个运行状况端点,它使用与 Ignite 使用的相同方法显示 JVM 报告的 CPUS 数量Runtime#availableProcessors()。
我们的所有应用程序(包括 Ignite 认为有 36 个 CPU 的应用程序)都会在进程启动后报告 2 个处理器。
我在该方法的 Java 文档中发现了这一有趣的行:
该值可能会在虚拟机的特定调用期间发生变化。因此,对可用处理器数量敏感的应用程序应偶尔轮询此属性并适当调整其资源使用情况。
我们似乎处于竞争状态,在应用程序启动初期,该值报告为 36,但在某些时候会下降到 2。根据 Ignite beans 的触发时间,它们会看到 36 或 2。