我有三个代码片段都在做同样的事情:创建内存中的身份验证.那么它如何影响在不同的方法名称中定义它?
第一:
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) 我想了解在开发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,则简单的前端不会创建服务。
谢谢,
JProfiler 中的 Net IO 时间是什么意思?
JProfilerguide 说如下,但我不知道它到底是什么意思?是花在网络上的时间还是等待网络的时间?如果net io时间很大该怎么解决?
在网络操作期间,Java 标准库中的许多调用可能会阻塞,因为它们正在等待更多数据。这种阻塞在 JProfiler 中称为“Net I/O”。JProfiler 知道 JRE 中导致网络 I/O 阻塞的方法列表,并在加载时对它们进行检测。