小编Nai*_*der的帖子

在Spring安全性中registerGlobal(),configure(),configureGlobal(),configureGlobalSecurity之间的区别

我有三个代码片段都在做同样的事情:创建内存中的身份验证.那么它如何影响在不同的方法名称中定义它?

  1. registerGlobal
  2. 配置
  3. configureGlobal
  4. configureGlobalSecurity

第一:

public void registerGlobal(AuthenticationManagerBuilder auth) throws Exception {
    auth
      .inMemoryAuthentication()
        .withUser("user").password("password").roles("USER").and()
        .withUser("admin").password("password").roles("USER","ADMIN");
    }
}
Run Code Online (Sandbox Code Playgroud)

第二个:

@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
    auth
         .inMemoryAuthentication()
              .withUser("user").password("password").roles("USER");
 }
Run Code Online (Sandbox Code Playgroud)

第三个:

public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
    auth
         .inMemoryAuthentication()
              .withUser("user").password("password").roles("USER");
}
Run Code Online (Sandbox Code Playgroud)

第四:

@Autowired
public void configureGlobalSecurity(AuthenticationManagerBuilder auth)     throws Exception {
    auth.inMemoryAuthentication().withUser("user").password("user").roles("USER");
}
Run Code Online (Sandbox Code Playgroud)

更新1: 我还想补充一点:

configure()方法存在于WebSecurityConfigurerAdapter类中,而其他类不存在.

更新2:

我将示例项目中的方法重命名为以下内​​容,令我惊讶的是它正在对用户进行工作和身份验证.

你把它命名为什么,它的工作原理

@Autowired
public void anyMethodName(AuthenticationManagerBuilder auth) throws Exception {
            auth.inMemoryAuthentication().withUser("user").password("user").roles("USER");      
}
Run Code Online (Sandbox Code Playgroud)

java spring spring-security

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

cxf-rt-transports-http-jetty的目的

我想了解在开发cxf Web服务时以下依赖的目的。

<dependency>
    <groupId>org.apache.cxf</groupId>
    <artifactId>cxf-rt-transports-http-jetty</artifactId>
    <version>3.1.7</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)

如果不添加此依赖项CXF,则简单的前端不会创建服务。

谢谢,

cxf jetty

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

JProfiler 中的 Net IO 是什么意思?

JProfiler 中的 Net IO 时间是什么意思?

JProfilerguide 说如下,但我不知道它到底是什么意思?是花在网络上的时间还是等待网络的时间?如果net io时间很大该怎么解决?

在网络操作期间,Java 标准库中的许多调用可能会阻塞,因为它们正在等待更多数据。这种阻塞在 JProfiler 中称为“Net I/O”。JProfiler 知道 JRE 中导致网络 I/O 阻塞的方法列表,并在加载时对它们进行检测。

jprofiler

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

标签 统计

cxf ×1

java ×1

jetty ×1

jprofiler ×1

spring ×1

spring-security ×1