小编aaa*_*hhh的帖子

Spring Boot应用程序无法在CloudFoundry中启动

我有一个使用maven,jdk1.8构建的Spring启动应用程序.它使用嵌入式Tomcat和jar包装.我正在使用Spring Tool Suite将应用程序推送到CloudFoundry.推送后我在控制台中收到以下消息:

[CONTAINER] org.apache.jasper.servlet.TldScanner               INFO  At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time. 
[CONTAINER] org.apache.catalina.startup.HostConfig             INFO  Deployment of web application directory /home/vcap/app/.java-buildpack/tomcat/webapps/ROOT has finished in 724 ms
[CONTAINER] org.apache.coyote.http11.Http11NioProtocol         INFO  Starting ProtocolHandler ["http-nio-8080"]
[CONTAINER] org.apache.tomcat.util.net.NioSelectorPool         INFO  Using a shared selector …
Run Code Online (Sandbox Code Playgroud)

spring-boot pivotal-cloud-foundry

4
推荐指数
1
解决办法
5155
查看次数

在 th:include 中使用变量构建片段名称 - ThymeLeaf + Spring Boot

我想使用fragment不带th:fragment(仅使用 id)的功能。在我的代码中,要包含的目标片段是从迭代器动态构建的。问题是创建正确的表达式以th:include正确渲染。我已经按照教程尝试了连接、预处理和文字替换,但没有结果 - 让我思考 - 这是否允许th:include

片段定义(它位于我的模板下调用的文件中Comments.html,以及我的其他模板)。

<div id="LOW_SCORE_COMMENT">
Run Code Online (Sandbox Code Playgroud)

它被这样称呼

<div class="well" th:each="commentFragment : ${allComments}">
    <div th:include="'Comments :: #' + {__${commentFragment}__}">
    </div>          
</div>
Run Code Online (Sandbox Code Playgroud)

allComments是一个Iterator<String>,并且检索到的字符串是片段 id,因此它应该构建整个页面。但我收到这个错误

org.thymeleaf.exceptions.TemplateInputException: Error resolving template "'Comments", template might not exist or might not be accessible by any of the configured Template Resolvers

请注意错误消息中 " 和 Comments 之间的单引号。

你有什么建议吗?

编辑:我尝试了这段代码

<div class="well" th:each="commentFragment,iterstat : ${allComments}"> <div th:include="${commentFragment.getValue()}"></div>

本质上改为allcommentsaTreeMap来解决排序问题,但现在错误如下:

org.thymeleaf.exceptions.TemplateInputException:解析模板“Comments :: …

thymeleaf spring-boot

3
推荐指数
1
解决办法
3897
查看次数

如何检查TreeMap是否是Java中另一个TreeMap的子图

Java 8的新手,我无法弄清楚这一点.我有两个类型的地图TreeMap<Long, Integer>,一个叫patternMap,另一个answerMap.

patternMap硬编码是为了寻找一个特定的键值对模式,所以有许多patternMap,它们的大小总是小于或等于answerMap.我想检查哪些patternMap是匹配的answerMap,我的意思是我需要完全匹配键和值两者,而不仅仅是一个.

我无法使用该submap方法,因为patternMap可能没有连续的键范围.显而易见的方法是遍历patternMapMap.Entry使用equals方法检查每个对象.但是,我有很多patternMap要检查特定的answerMap,所以我很想知道是否有更好的方法,可能使用lambdas/streams.我也无法修改answerMap或者patternMap,所以这必须是一个非变异函数.我使用TreeMap的是因为顺序对于应用程序很重要.

这里没有代码,因为我还没有找到这样做的方法,但伪代码看起来像这样:

for every patternMap in the Collection {
   if answerMap contains patternMap, make a note
}
Run Code Online (Sandbox Code Playgroud)

编辑:这里有一些定义(这不是工作代码,但希望问题更清楚:

 private static final TreeMap<Long, Integer> patternMap1;
 private static final TreeMap<Long, Integer> patternMap2;
 private static final ArrayList<TreeMap> listOfPatternMaps;
 private TreeMap<Long, Integer> answerMap;

  private Set<TreeMap<Long, …
Run Code Online (Sandbox Code Playgroud)

java collections dictionary

2
推荐指数
1
解决办法
391
查看次数