我想知道,我如何从Thymeleaf获取User对象.目前我正在调用我的userService,它将从DB获取用户.我不喜欢这种方法,因为每次调用都会进行数据库查询.
是否有可能从内存中获取用户?
<link href="/css/style2.css"
th:if="${@commanderService.getCurrentCommander()} and
${@commanderService.getCurrentCommander().settings == 'template=1'}"
rel="stylesheet" type="text/css" />
Run Code Online (Sandbox Code Playgroud)
CommanderService:
public Commander getCurrentCommander() {
Object principal =
SecurityContextHolder.getContext().getAuthentication().getPrincipal();
Commander commander = findByName((String)principal);
return commander;
}
Run Code Online (Sandbox Code Playgroud) 每15分钟我看到这个日志条目:
2018-07-30 10:29:57,529 INFO [pool-1-thread-2] NoSpamLogger.java:91 log达到的最大内存使用量(512.000MiB),不能分配1.000MiB的块
我一直在阅读这个问题,但我看不出我的表格有什么问题: NoSpamLogger.java最大内存使用量已达到Cassandra
我有4张大桌子:
iot_data/derived_device_data histograms
Percentile SSTables Write Latency Read Latency Partition Size Cell Count
(micros) (micros) (bytes)
50% 0.00 0.00 0.00 642 12
75% 0.00 0.00 0.00 17084 642
95% 0.00 0.00 0.00 263210 11864
98% 0.00 0.00 0.00 1629722 61214
99% 0.00 0.00 0.00 1955666 88148
Min 0.00 0.00 0.00 150 0
Max 0.00 0.00 0.00 4055269 152321
iot_data/derived_device_data_by_year histograms
Percentile SSTables Write Latency Read Latency Partition Size Cell Count
(micros) …Run Code Online (Sandbox Code Playgroud) 两个简单的问题:
这些选项中的任何一个都会创建“热”分区吗?
谢谢!
我有一些服务在 Kubernetes 中运行。我需要在它们前面放置一个 NGINX,根据 URL 重定向流量、处理 SSL 加密和负载平衡。
\n\n有一个适用于该场景的有效 nginx.conf。我\xc2\xb4m缺少的是在gcloud上设置架构的正确方法。
\n\n使用 nginx 启动 StatefulSet 并让负载均衡服务公开 NGINX 是否正确?我的理解是否正确,gcloud LB 会将配置的端口(fe 80 + 443)传递到我的 NGINX 服务,我可以在其中处理其余部分并将流量转发到后端服务?
\n我有这个方法:
public <T extends CacheResult> T get(Object key, CacheDefinition cacheDefinition) {
return load(key, cacheDefinition.name(), cacheDefinition.getTypeReference());
}
Run Code Online (Sandbox Code Playgroud)
现在我的 IDE 抱怨这一行(正如预期的那样,这是正确的),因为返回类型应该是CacheResult
User user = spxCacheManager.get(username, CacheDefinition.USERS_BY_USERNAME);
Run Code Online (Sandbox Code Playgroud)
我目前不明白的是,IDE(IntelliJ)并没有抱怨这一点:
List<User> usersFromCache = spxCacheManager.get(username, CacheDefinition.USERS_BY_USERNAME);
Run Code Online (Sandbox Code Playgroud)
这实际上是错误的。我在这里缺少什么?
我使用这样的片段:
@RequestMapping(value="/fragment/nodeListWithStatus", method= RequestMethod.GET)
public String nodeListWithStatus(Model model) {
// status der nodes
model.addAttribute("nodeList", nodeService.getNodeListWithOnlineStatus());
return "/fragments :: nodeList";
}
Run Code Online (Sandbox Code Playgroud)
模板位于 /src/main/resources/templates 中。从 IntelliJ 启动应用程序时,这工作正常。一旦我创建了一个 .jar 并启动它,上面的代码就不再起作用了。错误:
[2014-10-21 20:37:09.191] log4j - 7941 ERROR [http-nio-666-exec-2] --- TemplateEngine: [THYMELEAF][http-nio-666-exec-2] Exception processing template "/fragments": Error resolving template "/fragments", template might not exist or might not be accessible by any of the configured Template Resolvers
Run Code Online (Sandbox Code Playgroud)
当我用 winrar 打开 .jar 时,我看到 /templates/fragments.html - 所以它似乎在那里。
我的 pom.xml 有这部分用于构建 jar(Maven 清理,安装):
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration> …Run Code Online (Sandbox Code Playgroud) 我正在玩春季靴子.所以我想创建两个互相交互的微服务.我的问题是我无法启动它们,因为当第一个应用程序已经使用自己的tomcat运行时,第二个应用程序无法启动:
Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to start embedded Tomcat
Run Code Online (Sandbox Code Playgroud)
我怎样才能解决这个问题?
谢谢!
spring ×3
spring-boot ×3
cassandra ×2
thymeleaf ×2
cql ×1
elassandra ×1
fragment ×1
java ×1
kubernetes ×1
nginx ×1
tomcat ×1