小编sam*_*ers的帖子

Spring Web Security 中 AuthenticationEntryPoint 的用途是什么?

Spring Web Security 中AuthenticationEntryPoint的用途是什么?该文档没有提供太多细节。什么时候应该使用它,它与 Spring Security 过滤器链有什么关系。

spring spring-security servlet-filters spring-boot

23
推荐指数
2
解决办法
2万
查看次数

jwks 中的 "e": "AQAB" 是什么意思?

"e": "AQAB"JWKS - Json Web 密钥集是什么意思

{
  "keys": [
    {
      "kty": "RSA", #key type
      "e": "AQAB",  #Question - what does "e" mean or stand for. And what values can e take. What is AQAB here. 
      "use": "sig", #verify client assertion signature. This means what is the use of the key. Answer - to verify signature. Right?
      "kid": "somebase64encodestring", #key id
      "alg": "RS256",  #key algoritham. Here it is RSA.
      "n": "anotherbase64encodestring"  #This is the actual public key base64 encoded.
    } …
Run Code Online (Sandbox Code Playgroud)

jwt jose4j jwk nimbus-jose-jwt

12
推荐指数
1
解决办法
8771
查看次数

当 HEALTHCHECK 失败时 Docker 容器会发生什么

docker文档说明了什么HEALTHCHECK是指令以及如何检查容器的运行状况。但我无法弄清楚健康检查失败时会发生什么。就像按照用户指令重新启动或停止容器或这两者中的任何一个一样。

另外引用的例子是:
HEALTHCHECK --interval=5m --timeout=3s CMD curl -f http://localhost/ || exit 1

exit 1关于什么的?

docker dockerfile kubernetes-health-check health-check

10
推荐指数
2
解决办法
7562
查看次数

Spring IoC/DI 中接口使用 @Component 注解进行注解。可能是什么原因?

有时接口会使用@Component 注解进行注解。那么我的明显推理是实现此类接口的类也将被视为组件。但如果我是对的,情况就不是这样了。

那么接口上@Component注解的目的是什么呢?

java spring dependency-injection inversion-of-control spring-ioc

9
推荐指数
1
解决办法
2万
查看次数

使用 Hibernate 6.x 和 Spring Boot 2.7.x 不起作用?

我尝试将 Hibernate Core 6.x 与 Spring Boot / Spring Data JPA 2.7.x 项目一起使用,但它无法获取 Hibernate 6.x 类。

正如您在pom中看到的,在 spring-boot-starter-data-jpa 中,我排除了 hibernate-core 5.6.10-final 并添加了 6.x 作为项目依赖项。

但我看到以下错误:

***************************
APPLICATION FAILED TO START
***************************

Description:

A component required a bean of type 'javax.persistence.EntityManagerFactory' that could not be found.


Action:

Consider defining a bean of type 'javax.persistence.EntityManagerFactory' in your configuration.
Run Code Online (Sandbox Code Playgroud)

我不认为 Spring Boot 会自动配置新的 Hibernate 6.x 版本。

对于 5.6.x,我可以看到以下 11 个 EntityManager 实现。

在此输入图像描述

在迁移到 6.x 时,我只看到一种实现。 在此输入图像描述

发生了什么事,我不知道。有人可以参与并帮助解决这个问题吗?

为什么我想要 6.x ->看看 RIGHT JOIN …

hibernate jpa spring-data-jpa spring-boot hibernate-6.x

9
推荐指数
1
解决办法
1万
查看次数

Docker 上的桥接网络与 VMWare/VirtualBox 上的桥接网络似乎非常不同。为什么?

TL;DR - 当 Docker 看起来很像 NAT 网络时,为什么将它的默认网络称为桥接网络。

让我们先看看如何 -
1) VMWare 或 VirtualBox处理虚拟机的网络。假设主机 IP 是一些随机的 152.50.60.21,网络 CIDR 是 152.50.60.0/24。
桥接网络- 通过此接口连接的任何 VM 都可以在主机所连接的网络上拥有任何空闲 IP。因此,如果 IP 152.50.60.30 空闲,则 VM 可以绑定到此 IP。同样,如果 IP 是免费的,则第二个 VM 可以拥有 IP 152.50.60.32。桥接网络将虚拟机连接到主机所连接的同一网络。Internet 上的任何机器都可以访问 VM,VM 可以直接访问 Internet(当然,如果 HOST 网络连接到 Internet)。
NAT网络- NAT 是一个独立于主机所连接网络的网络。并且 VMWare 可以接受任何有效的 CIDR(为了不使事情复杂化,我将仅提及私有保留块。不过,如果我是对的,任何 CIDR 都可以。)安全地,这个新的 NAT 网络是在主机上创建的,并且只能在主机上访问可以有 CIDR 10.0.0.0/8 或 172.16.0.0/12 或 192.168.0.0/16(或这些网络的任何子网)。我选择 10.0.0.0/8。因此,在主机上旋转并通过 NAT 网络连接的两个 VM 可以具有 IP 10.0.3.3 和 10.0.3.6 在 NAT 网络上,VM 对主机以外的外部世界不可见,即 VM 无法访问外部世界(主机上的 DNAT/端口转发配置除外)。但是VM可以通过HOST提供的SNAT访问外部世界/互联网/内联网,即IP'

VMWare Doc …

vmware virtualbox bridge nat docker

7
推荐指数
1
解决办法
1441
查看次数

Kubernetes POD 是否有与其关联的命名空间和 cgroup?

Docker 容器具有与之关联的 cgroup 和命名空间,无论它们是在 pod、虚拟机​​还是主机中运行。
同样,Kubernetes Pod 是否具有与其关联的命名空间和 cgroup,或者只是 pod 内的容器具有这些(cgroup 和命名空间)关联。如果他们这样做,我如何从主机那里找到这些信息?

cgroups kubernetes docker-container linux-namespaces kubernetes-pod

7
推荐指数
2
解决办法
3723
查看次数

如何使用 main(String[] args) 方法中的自动装配(@Autowired)引用?

我正在尝试使用来自主类的自动装配引用并且面临:

无法对非静态字段 zipCodeLookupService 进行静态引用。

这是显而易见的。但我想知道如何处理这种情况。涉及主类时自动装配的正确方法是什么。我的代码如下 -

接口类

package com.example.services;
public interface IZipCodeLookup {
    String retriveCityForZip(String zipCode);
}
Run Code Online (Sandbox Code Playgroud)

服务等级

package com.example.services;

import org.springframework.stereotype.Service;

@Service
public class ZipCodeLookupService implements IZipCodeLookup {

    @Override
    public String retriveCityForZip(String zipCode) {

        //below is mock code. actual code does a db lookup using a DAO.
        if(zipCode=="94123") return "San Francisco";
        return "not found in DB";
    }
}
Run Code Online (Sandbox Code Playgroud)

这是需要服务类的主类

package com.example.demo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import com.example.services.IZipCodeLookup;

@SpringBootApplication
public class AutowireWithMainClassApplication {

    @Autowired
    IZipCodeLookup zipCodeLookupService;

    public static …
Run Code Online (Sandbox Code Playgroud)

spring dependency-injection inversion-of-control autowired spring-boot

6
推荐指数
2
解决办法
8341
查看次数

使用spring-boot-starter-data-redis时,如何设置驱逐策略?LFU 还是 LRU 等?

当redis通过spring boot()作为缓存技术时<artifactId>spring-boot-starter-data-redis</artifactId>,我看到文件中很少有像TTL这样的属性可以设置application.properties。前任:

spring.cache.cache-names=cache1,cache2
spring.cache.redis.time-to-live=600000
Run Code Online (Sandbox Code Playgroud)

以及附录 A 中的更多片段。常见应用程序属性

spring.redis.database=0 # Database index used by the connection factory.
spring.redis.url= # Connection URL. Overrides host, port, and password. User is ignored. Example: redis://user:password@example.com:6379
spring.redis.host=localhost # Redis server host.
Run Code Online (Sandbox Code Playgroud)

但我无法弄清楚如何设置缓存逐出策略,例如 - 最不常用或最近最后使用等。
我必须如何以及在哪里提供此配置详细信息?

spring redis spring-data-redis spring-boot

5
推荐指数
1
解决办法
2650
查看次数

当 pod 包含多个容器时,K8s 的活性探测行为?

场景:一个 K8S Pod 具有多个容器,并且为每个容器配置活性/就绪探针。现在,如果活性探测在某些容器上成功,但在少数容器上失败,k8s 会做什么。

  1. 它会仅重新启动失败的容器
    还是
  2. 它会重新启动整个 Pod 吗?

kubernetes kubernetes-pod readinessprobe livenessprobe

5
推荐指数
2
解决办法
8643
查看次数