让我简短地描述一下我现在面临的问题。
\n我已经为 webflux 应用程序配置了 spring security,当我尝试访问不需要身份验证的路由时,我收到登录表单提示。路线是 /swagger-ui/ ,它应该在没有任何登录表单或其他内容的情况下打开。
\n下面是我在 SecurityWebFilterChain 中的代码
\n\n@Bean\npublic SecurityWebFilterChain securityWebFilterChain(ServerHttpSecurity http) {\n //@formatter:off\n return http\n .formLogin().disable()\n .httpBasic().disable()\n .authenticationManager(authenticationManager)\n .securityContextRepository(securityContextRepository)\n .authorizeExchange()\n .pathMatchers(HttpMethod.OPTIONS).permitAll()\n .pathMatchers("/v2/api-docs", "/v3/api-docs", "/configuration/ui", "/swagger-resources",\n "/configuration/security", "/swagger-ui/", "/swagge\xe2\x80\x8c\xe2\x80\x8br-ui",\n "/webjars/**", "/swagger-resources/configuration/ui",\n "/swagger-resources/configuration/security").permitAll() // Allowed routes for swagger\n .pathMatchers("/api/auth", "/api/auth/**").permitAll() // Allowed routes for auth\n .and()\n .authorizeExchange()\n .anyExchange()\n .authenticated() // All other routes require authentication\n .and()\n .csrf().disable()\n .headers()\n .hsts()\n .includeSubdomains(true)\n .maxAge(Duration.ofSeconds(31536000))\n .and()\n .frameOptions().mode(XFrameOptionsServerHttpHeadersWriter.Mode.SAMEORIGIN)\n .and()\n .build();\n //@formatter:on\n }\n}\nRun Code Online (Sandbox Code Playgroud)\n如果有人有任何建议,请告诉我,我将不胜感激。这是我在浏览器中得到的图片。
\n\n我在 android 应用程序中遇到了一些本地化问题。
当我在api 级别 24及更高级别上测试时,更改语言的功能正常工作,但是当我在模拟器api 级别 23上更改语言时,它不会应用本地更改。我在很多论坛上都读到过这个,我几乎尝试了所有提供的解决方案,但它就是行不通。
重要的是,关闭弹出菜单的动画,即 listPreference,比 Android Nougat 上的关闭动画略显奇怪,所以它已经闻起来有些不规则。
重要说明是,我在 api 级别 23 或 Marshmallow 的物理设备上运行应用程序,但问题仍然存在。
在下面的部分中,我提供了一些对这种情况很重要的代码,另一方面,我省略了一些对于这种情况不需要的文件,例如strings.xml和preferences.xml。因此,这里的主要重点是实现更改应用程序语言的可能性。如果你们中有任何人有线索,我会请他与我们分享可能是什么问题。
用于设置 Locale 的 Helper 类
package com.metropolitan.hangouter;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.res.Configuration;
import android.os.Build;
import java.util.Locale;
public class MyContextWrapper extends ContextWrapper {
public MyContextWrapper(Context base) {
super(base);
}
@SuppressWarnings("deprecation")
public static ContextWrapper wrap(Context context, String language) {
Configuration config = context.getResources().getConfiguration();
Locale sysLocale = null; …Run Code Online (Sandbox Code Playgroud)