我想创建一个Map从List的PointS和有地图从里面用相同的parentId,如映射列表中的所有条目Map<Long, List<Point>>.
我用过Collectors.toMap()但不编译:
Map<Long, List<Point>> pointByParentId = chargePoints.stream()
.collect(Collectors.toMap(Point::getParentId, c -> c));
Run Code Online (Sandbox Code Playgroud) 任何人都可以在这个Spring Security Config文件中看到失败?
登录后,我得到一个调试消息:
访问被拒绝(用户不是匿名的); 委托给AccessDeniedHandler org.springframework.security.access.AccessDeniedException:访问被拒绝
但我可以访问该应用程序.
@Override
protected void configure(HttpSecurity http) throws Exception {
http.
authorizeRequests().antMatchers("/register/verification/*/*").anonymous()
.and().authorizeRequests().antMatchers("/register/test").anonymous()
.and().authorizeRequests().antMatchers("/register").anonymous()
.and().authorizeRequests().antMatchers("/forgot_password").anonymous().and().authorizeRequests().antMatchers("/triggeredBy/password**").permitAll()
.and().authorizeRequests().antMatchers("/err/403").permitAll()
.and().authorizeRequests().antMatchers("/login").anonymous()
.and().authorizeRequests().anyRequest().authenticated()
.and().formLogin().loginPage("/login").defaultSuccessUrl("/landingPage", true).failureUrl("/login?error=true").usernameParameter(
"username").passwordParameter("password").and().logout().logoutUrl("/logout").logoutSuccessUrl("/login?logout").and()
.rememberMe().rememberMeCookieName("REMEMBER_ME").rememberMeParameter("remember_me").tokenValiditySeconds(123456).key(
"49874795145977617241")
.and().exceptionHandling().accessDeniedPage("/err/403");
}
Run Code Online (Sandbox Code Playgroud)
堆栈跟踪:
2016-01-11 12:09:17.826 DEBUG 1372 --- [nio-8080-exec-9] tRepository$SaveToSessionResponseWrapper : Skip invoking on
2016-01-11 12:09:17.826 DEBUG 1372 --- [nio-8080-exec-8] tRepository$SaveToSessionResponseWrapper : Skip invoking on
2016-01-11 12:09:17.826 DEBUG 1372 --- [nio-8080-exec-5] tRepository$SaveToSessionResponseWrapper : Skip invoking on
2016-01-11 12:09:17.826 DEBUG 1372 --- [nio-8080-exec-3] o.s.s.w.u.matcher.AntPathRequestMatcher : Checking match of request : '/login'; against …Run Code Online (Sandbox Code Playgroud) 我正在寻找一种在gitlab中使用kubectl的方法.
到目前为止,我有以下脚本:
deploy_to_dev:
stage: deploy
image: docker:dind
environment:
name: dev
script:
- mkdir -p $HOME/.kube
- echo $KUBE_CONFIG | base64 -d > $HOME/.kube/config
- kubectl config view
only:
- develop
Run Code Online (Sandbox Code Playgroud)
但它说gitlab不知道kubectl.所以你能指出我正确的方向吗?
我使用的是GitLab企业版10.4.4-ee,这是有关同一问题的一些信息,应予以修复:https : //gitlab.com/gitlab-org/gitlab-runner/issues/2570。除了以root用户身份重写dockerfile以外,还有其他解决方案吗?
当我尝试在gitlab-ci中执行此操作时出现此错误。
stages:
- run_test_chrome
tests run:
image: selenium/standalone-chrome
stage: run_test_chrome
script:
- echo test
Run Code Online (Sandbox Code Playgroud)
我想使用将$CI_ENVIRONMENT_SLUG我们的 Selenium 测试指向正确的动态环境,但该变量为空。
在部署阶段它有一个正确的值,我不明白为什么该变量在每个阶段都不可用。cmdecho打印一个空行。
Tests:
image: maven:3.5.0-jdk-8
stage: Tests and static code checks
variables:
QA_PUBLISH_URL: http://$CI_ENVIRONMENT_SLUG-publish.test.com
script:
- echo $QA_PUBLISH_URL
- echo $CI_ENVIRONMENT_SLUG # empty
- mvn clean -Dmaven.repo.local=../../.m2/repository -B -s ../../settings.xml -P testrunner install -DExecutionID="FF_LARGE_WINDOWS10" -DRunMode="desktopLocal" -DSeleniumServerURL="https://$QA_ZALENIUM_USER:$QA_ZALENIUM_PASS@zalenium.test.com/wd/hub" -Dcucumber.options="--tags @sanity" -DJenkinsEnv="test.com" -DSeleniumSauce="No" -DBaseUrl=$QA_PUBLISH_URL
Run Code Online (Sandbox Code Playgroud) 这个指标的解释是什么:system_load_average_1m
这是帮助文本,但我不太明白。
HELP system_load_average_1m 一段时间内排队到可用处理器的可运行实体数量与在可用处理器上运行的可运行实体数量的平均总和
在本例中,我有一个 CPU。
是否意味着同时需要解决的任务太多,任务正在排队等待解决?那么系统会卡在这段时间吗?
我只是想检查一下我是否做得对.这是使用可选的正确方法还是可以改进?
String longitudeResult = "Address_Longitude is empty or null;";
String latitudeResult = "Address_Latitude is empty or null;";
if (Optional.ofNullable(location).isPresent()) {
Optional<Double> longitude = Optional.ofNullable(location.getLongitude());
Optional<Double> latitude = Optional.ofNullable(location.getLatitude());
if (longitude.isPresent()) {
longitudeResult = longitude.get().toString();
}
if (latitude.isPresent()) {
latitudeResult = latitude.get().toString();
}
}
Run Code Online (Sandbox Code Playgroud) 我想用它为gcp中的linux机器生成一个随机密码。
我的问题是我以后如何获取密码。我应该为此使用输出,还是将其存储在其他任何地方?我在互联网上看到了这段代码,然后问自己如何知道密码。
resource "random_string" "master_password" {
length = 16
special = true
}
resource "google_container_cluster" "test" {
name = "test"
zone = "europe-west1-d"
master_auth {
username = "client"
password = "${random_string.master_password.result}"
}
node_pool = [{
name = "pool"
autoscaling = {
min_node_count = 1
max_node_count = 3
}
node_config {
disk_size_gb = 100
machine_type = "n1-standard-2"
oauth_scopes = [
"https://www.googleapis.com/auth/compute",
"https://www.googleapis.com/auth/devstorage.read_only",
"https://www.googleapis.com/auth/logging.write",
"https://www.googleapis.com/auth/monitoring",
]
labels {
test = "true"
}
}
}]
}
Run Code Online (Sandbox Code Playgroud) 我想知道两者之间的区别以及何时在SpringMVC Controller中使用它们。
溴
提姆
您能举一个例子,说明如何使用Java 8 Optional来转换它.
Motion motion = new Motion();
if (null!= site.getLocation() && null != site.getLocation().getLatitude() && null != site.getLocation().getLongitude()) {
Point p = GeoJson.point(site.getLocation().getLatitude(), site.getLocation().getLongitude());
motion.setLocation(p);
}
Run Code Online (Sandbox Code Playgroud)
到目前为止,我这样做
Motion motion = new Motion();
Optional<Location> locationOptional = Optional.ofNullable(site.getLocation());
Point p = locationOptional
.map(location -> {
if (Optional.ofNullable(location.getLatitude()).isPresent() && Optional.ofNullable(location.getLongitude()).isPresent()) {
return GeoJson.point(location.getLatitude(), location.getLongitude());
}
return null;
})
.orElse(null);
motion.setLocation(p);
Run Code Online (Sandbox Code Playgroud) java ×5
gitlab-ci ×3
java-8 ×3
optional ×2
spring ×2
collectors ×1
kubectl ×1
micrometer ×1
scope ×1
security ×1
spring-mvc ×1
terraform ×1