我正在尝试在本地 kubernetes(Windows 版 docker)上设置 redis-ha helm 图表。
我正在使用的 helm 值文件是,
## Configure resource requests and limits
## ref: http://kubernetes.io/docs/user-guide/compute-resources/
##
image:
repository: redis
tag: 5.0.3-alpine
pullPolicy: IfNotPresent
## replicas number for each component
replicas: 3
## Custom labels for the redis pod
labels: {}
## Pods Service Account
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/
serviceAccount:
## Specifies whether a ServiceAccount should be created
##
create: false
## The name of the ServiceAccount to use.
## If not set and create is true, a …
Run Code Online (Sandbox Code Playgroud) 我有一个带有以下元素的 dto 列表。userSeqId
有重复的值,
private int userSeqId;
private String firstName;
private String lastName;
private String acctAgencyNumber;
Run Code Online (Sandbox Code Playgroud)
我正在尝试使用 Java 8 Lambda 按“userSeqId”分组到地图。
我想要Map<Integer, List<String>>
Key 应该在哪里userSeqId
,Value 是acctAgencyNumber
.
当我使用
Map<Integer, List<UserBasicInfoDto>> superUserAcctMap = customerSuperUserList.stream()
.collect(Collectors.groupingBy(UserBasicInfoDto::getUserSeqId));
Run Code Online (Sandbox Code Playgroud)
我知道Map<Integer, List<UserBasicInfoDto>>
键在哪里,userSeqId
但值是整个对象的列表。
我用Vite创建了一个Svelte项目并添加了windicss。我使用 Yarn 作为构建工具。我使用https://windicss.org/integrations/vite.html#install将 WindiCSS 添加到 vite 中。当我使用启动项目时效果很好,
yarn dev
Run Code Online (Sandbox Code Playgroud)
但 Windi CSS 的 HMR(热模块重载)不起作用。但是当我终止服务器并重新启动时,它会获取 Windi CSS 更改。即使 Devtool 的更改也工作正常,只有 HMR 不起作用。
package.json
文件,
{
"name": "svelte-in",
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"serve": "vite preview"
},
"devDependencies": {
"@sveltejs/vite-plugin-svelte": "^1.0.0-next.11",
"svelte": "^3.37.0",
"vite": "^2.6.4",
"vite-plugin-windicss": "^1.4.11",
"windicss": "^3.1.9"
}
}
Run Code Online (Sandbox Code Playgroud)
vite.config.js
文件,
import { defineConfig } from 'vite'
import { svelte } from '@sveltejs/vite-plugin-svelte'
import WindiCSS from 'vite-plugin-windicss'
// https://vitejs.dev/config/
export default defineConfig({ …
Run Code Online (Sandbox Code Playgroud) 我有Map
以下结构,我想翻转键和值。
Map<String, List<String>> dataMap
Run Code Online (Sandbox Code Playgroud)
样本数据 :
acct01: [aa, ab, ad],
acct02: [ac, ad]
acct03: [ax, ab]
Run Code Online (Sandbox Code Playgroud)
想要将这些数据转换为,
aa: [acct01],
ab: [acct01, acct03],
ac: [acct02],
ad: [acct01, acct02],
ax: [acct03]
Run Code Online (Sandbox Code Playgroud)
想知道有没有java 8-stream的方式来转换Map。
我当前的实现(没有流)
Map<String, List<String>> originalData = new HashMap<String, List<String>>();
originalData.put("Acct01", Arrays.asList("aa", "ab", "ad"));
originalData.put("Acct02", Arrays.asList("ac", "ad"));
originalData.put("Acct03", Arrays.asList("ax", "ab"));
System.out.println(originalData);
Map<String, List<String>> newData = new HashMap<String, List<String>>();
originalData.entrySet().forEach(entry -> {
entry.getValue().forEach(v -> {
if(newData.get(v) == null) {
List<String> t = new ArrayList<String>();
t.add(entry.getKey());
newData.put(v, t);
} else { …
Run Code Online (Sandbox Code Playgroud) 今天我将我的 Webflux REST API 演示应用程序从 springboot 升级2.7.x
到了 version 3.0.0
。在使用 SpringSecurity 测试 POST 调用时,我收到了403 Forbidden
消息An expected CSRF token cannot be found
。我仔细检查了我的安全配置,没有发现任何问题。
@Bean
public SecurityWebFilterChain securityWebFilterChain(ServerHttpSecurity http) {
return http
.csrf().disable()
.authorizeExchange()
.pathMatchers(HttpMethod.GET, "/actuator/**").permitAll()
.pathMatchers(HttpMethod.POST, "/api/v1/users", "/api/v1/users/**").hasRole(ReactiveConstant.SECURITY_ROLE_ADMIN) // Only admin can do POST
.pathMatchers(HttpMethod.GET, "/api/v1/users", "/api/v1/users/**").hasAnyRole(ReactiveConstant.SECURITY_ROLE_USER, ReactiveConstant.SECURITY_ROLE_ADMIN) // user can only do GET
.anyExchange().authenticated()
.and().formLogin()
.and().httpBasic()
.and().formLogin().disable()
.build();
}
Run Code Online (Sandbox Code Playgroud)
这适用于 SpringBoot 2.7.5 版本。我的build.gradle
文件,
plugins {
id 'org.springframework.boot' version '3.0.0'
id 'io.spring.dependency-management' version '1.1.0' …
Run Code Online (Sandbox Code Playgroud) java ×1
java-8 ×1
java-stream ×1
kubernetes ×1
lambda ×1
redis ×1
spring-boot ×1
svelte ×1
vite ×1
windicss ×1
yarnpkg ×1