Springboot登录

时间:2018-08-11 09:29:06

标签: spring spring-boot login

我正在使用springboot,并且遇到以下问题。

我从WebPage凭据获得登录到我们的中间件。

使用这些代码对中间件进行身份验证,生成与中间件的有效连接,然后我就可以在Middlewrae和我的应用程序之间进行通信了。

public String user =“ testuser”;   public String password =“ testpw”;

@Bean({"mybean"})
public BasicAuthRequestInterceptor basicAuthRequestInterceptor() {
    return new BasicAuthRequestInterceptor( user, password );
}

但是我无法在运行时设置用户名和密码。该应用程序始终使用硬编码testuser和testpw。

我尝试在运行时通过ApplicationContext.getBean(“ mybean”)凭据进行设置,但没有找到方法。

0 个答案:

没有答案