我有以下表达式:
scheduleIntervalContainers.stream()
.filter(sic -> ((ScheduleIntervalContainer) sic).getStartTime() != ((ScheduleIntervalContainer)sic).getEndTime())
.collect(Collectors.toList());
Run Code Online (Sandbox Code Playgroud)
... scheduleIntervalContainers
元素类型在哪里ScheduleContainer
:
final List<ScheduleContainer> scheduleIntervalContainers
Run Code Online (Sandbox Code Playgroud)
是否可以在过滤器之前检查类型?
我现在使用AngularJS 1.x几个月了.现在我将切换到Angular2(使用TypeScript),实际上我不确定使用哪个IDE.我还不清楚如何将TypeScript代码编译成JavaScript - 实际上这是必要的吗?我已经读过Visual Studio Code对于Angular2项目来说是一个不错的编辑器 - 是否包含TypeScript编译器?我很乐意收到这方面的任何信息.
在我的应用程序中,我有很多REST服务.我已经为所有服务编写了测试:
org.springframework.web.client.RestTemplate
Run Code Online (Sandbox Code Playgroud)
REST服务调用例如下所示:
final String loginResponse = restTemplate.exchange("http://localhost:8080/api/v1/xy", HttpMethod.POST, httpEntity, String.class)
.getBody();
Run Code Online (Sandbox Code Playgroud)
然后我检查响应体 - 一切正常.缺点是必须启动应用程序才能调用REST服务.
我现在的问题是如何在JUnit- @Test方法中做到这一点?它是一个Spring Boot应用程序(带有嵌入式tomcat).
感谢帮助!
我在Angular 5应用程序中使用此角度材质选择:
<mat-form-field style="width:88%;">
<mat-select placeholder="Contact *" formControlName="contact">
<mat-option *ngFor="let contact of contacts" [value]="contact">
<mat-icon [ngStyle]="{'color': contact.color}">home</mat-icon>{{contact.institution}}
</mat-option>
</mat-select>
</mat-form-field>
Run Code Online (Sandbox Code Playgroud)
在选择面板上,<mat-icon>
s被列为预期,但如果我选择一个选项而不是主页,则在<mat-form-field>
我的问题中列出现在将如何查看主页图标<mat-form-field>
我在MongoDB中插入了一个init文件:
db.User.insert({ "_id" : ObjectId("5589929b887dc1fdb501cdba"), "_class" : "com.smartinnotec.aposoft.dao.domain.User", "title" : "DI.", ... "address" : { "_id" : null, ... "country" : "Österreich" }})
Run Code Online (Sandbox Code Playgroud)
如果我用db.User.find()调用此条目,那么我得到以下内容:
{ "_id" : ObjectId("5589929b887dc1fdb501cdba"), "_class" : "com.smartinnotec.aposoft.dao.domain.User", "title" : "DI.", ... "address" : { "_id" : null, ... "country" : "�sterreich" } }
Run Code Online (Sandbox Code Playgroud)
带有特殊字符的单词"�sterreich不正确.
有没有人知道我在mongodb可以做些什么才能解决这个问题?
string-formatting utf special-characters mongodb spring-data
我需要有可能询问用户他/她是否要离开页面.我读到他的可能性,但是当我进入页面而不是当我离开页面时事件被触发. onExit可以工作,但是这个事件我必须在...... .routes.js中定义,我需要访问控制器的属性和功能.是否有一个由页面退出触发的事件?
$scope.$on('$locationChangeStart', function( event ) {
var answer = confirm("Are you sure you want to leave this page?")
if (!answer) {
event.preventDefault();
}
});
Run Code Online (Sandbox Code Playgroud) 我有这些证书/文件,以便为我的应用程序启用SSL:
我发现Spring Boot需要这些属性才能启用HTTPS:
server.port=8089
server.ssl.enabled=true
server.ssl.key-store=src/main/resources/keystore.p12
server.ssl.key-store-password=****
server.ssl.keyStoreType=PKCS12
server.ssl.keyAlias=tomcat
Run Code Online (Sandbox Code Playgroud)
但这不起作用.我现在的问题是我需要做些什么才能让它发挥作用?https://abc.lehr.co.at应该是URL.
[编辑]
我创建了自己的密钥库 - 我得到以下异常:
java.io.IOException: Alias name tomcat does not identify a key entry
at org.apache.tomcat.util.net.jsse.JSSESocketFactory.getKeyManagers(JSSESocketFactory.java:596)
at org.apache.tomcat.util.net.jsse.JSSESocketFactory.getKeyManagers(JSSESocketFactory.java:534)
at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:363)
at org.apache.tomcat.util.net.AbstractEndpoint.start(AbstractEndpoint.java:739)
at org.apache.coyote.AbstractProtocol.start(AbstractProtocol.java:472)
at org.apache.coyote.http11.Http11NioProtocol.start(Http11NioProtocol.java:81)
at org.apache.catalina.connector.Connector.startInternal(Connector.java:986)
Run Code Online (Sandbox Code Playgroud)
我的密钥库看起来像这样:
实际上我不知道要导入到密钥库中的嵌入式tomcat(Spring Boot)是什么.
在Java 8中有更好的方法吗?
final List<InstitutionUserConnection> allInstitutionUserConnections = new ArrayList<>();
for (final Institution institution : institutionsOfUser) {
allInstitutionUserConnections
.addAll(institutionUserConnectionService.getActiveInstitutionUserConnectionsByInstitution(institution));
}
Run Code Online (Sandbox Code Playgroud) 我将使用maven依赖com.samaxes.maven#minify-maven-plugin来缩小我的前端项目.这个前端项目被打包成一个jar(java档案) - 所以我没有war文件,因为我使用Spring启动.
使用底部的配置*.min.js和*.min.css生成文件,但它们不会被打包到jar文件中.我已经阅读了一些线程,但我尝试了一些但没有成功:在JAR文件中仍然存在未经编译的css和js文件.
有没有人暗示我能做什么.我的项目中有很多css和js文件在不同的文件夹结构中,缩小的文件应放在同一个地方,就像未经文件化的文件一样.
<build>
<plugins>
<plugin>
<groupId>com.samaxes.maven</groupId>
<artifactId>minify-maven-plugin</artifactId>
<version>1.7.4</version>
<executions>
<execution>
<id>default-minify</id>
<phase>package</phase>
<configuration>
<charset>UTF-8</charset>
<skipMerge>true</skipMerge>
<nosuffix>true</nosuffix>
<closureCompilationLevel>WHITESPACE_ONLY</closureCompilationLevel>
<webappSourceDir>src/main/resources</webappSourceDir>
<cssSourceDir>./</cssSourceDir>
<cssTargetDir>./minified</cssTargetDir>
<cssSourceIncludes>
<cssSourceInclude>**/*.css</cssSourceInclude>
</cssSourceIncludes>
<cssSourceExcludes>
<cssSourceExclude>**/*.min.css</cssSourceExclude>
</cssSourceExcludes>
<jsSourceIncludes>
<jsSourceInclude>**/*.js</jsSourceInclude>
</jsSourceIncludes>
<jsSourceExcludes>
<jsSourceExclude>**/*.min.js</jsSourceExclude>
</jsSourceExcludes>
<jsEngine>CLOSURE</jsEngine>
</configuration>
<goals>
<goal>minify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
Run Code Online (Sandbox Code Playgroud)
[编辑]
我用这种方式编辑了Maven插件.我真的必须使用src/main/recoures - 它是我们项目的规范.
我现在的问题是不同文件夹中的文件在主文件夹路径public/app下缩小但是缩小文件的文件夹与我的公共文件夹相同.
所以我需要这样的东西:
<webappTargetDir>**public/app/**${project.build.outputDirectory}</webappTargetDir>
Run Code Online (Sandbox Code Playgroud)
有可能像这样做吗?
<build>
<plugins>
<plugin>
<groupId>com.samaxes.maven</groupId>
<artifactId>minify-maven-plugin</artifactId>
<version>1.7.4</version>
<executions>
<execution>
<id>default-minify</id>
<phase>prepare-package</phase><!-- When omitted defaults to 'process-resources' -->
<configuration>
<charset>UTF-8</charset>
<skipMerge>true</skipMerge>
<closureCompilationLevel>WHITESPACE_ONLY</closureCompilationLevel>
<webappSourceDir>src/main/resources/public/app</webappSourceDir>
<webappTargetDir>${project.build.outputDirectory}</webappTargetDir> …
Run Code Online (Sandbox Code Playgroud) 我编写了这个java方法但有时颜色String只有5个字符长.有谁知道为什么?
@Test
public void getRandomColorTest() {
for (int i = 0; i < 20; i++) {
final String s = getRandomColor();
System.out.println("-> " + s);
}
}
public String getRandomColor() {
final Random random = new Random();
final String[] letters = "0123456789ABCDEF".split("");
String color = "#";
for (int i = 0; i < 6; i++) {
color += letters[Math.round(random.nextFloat() * 15)];
}
return color;
}
Run Code Online (Sandbox Code Playgroud) java ×4
angular ×2
java-8 ×2
spring-boot ×2
angularjs ×1
colors ×1
https ×1
ide ×1
instanceof ×1
java-stream ×1
junit ×1
maven ×1
minify ×1
mongodb ×1
random ×1
rest ×1
spring-data ×1
ssl ×1
utf ×1