我已经实现了缓存,现在我想添加一个到期时间.
如何在春季启动时设置到期时间@Cacheable?
这是一段代码:
@Cacheable(value="forecast",unless="#result == null")
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用两个不同的端口在Spring Boot中配置应用程序,但我还没有.我的第一个aproximation是两个控制器,我在两个控制器中用container.setPort(8080)定义了一个@Bean; 我的第二个aproximation已经添加了执行器依赖并改变了管理的端口,但我的应用程序没有运行."地址已在使用中:绑定",如何使用两个端口来配置应用程序?我想要一个端口用于管理员,另一个端口用于我的api的咨询.
我想使用 Fabric8 插件进行 Spring 集成测试,但是当我尝试运行测试时出现下一个错误:
无法创建 docker 访问对象
我有 ubuntu,我认为我有配置良好的 docker,我在 dockerfiles 或 dockercompose 方面没有遇到任何问题,所以可能是权限问题或者我忘记了一些东西。
我过去的 Fabric8 配置如下,其中有 mysql 的映像和用于集成测试的 maven-failsafe-plugin。
<!--maven plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
<configuration>
<environmentVariables>
<it-database.port>${it-database.port}</it-database.port>
</environmentVariables>
</configuration>
</plugin>
<!--fabric8 plugin -->
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.18.1</version>
<configuration>
<!--<dockerHost>unix:///var/run/docker.sock</dockerHost>-->
<dockerHost>tcp://0.0.0.0:2375</dockerHost>
</configuration>
<executions>
<execution>
<id>prepare-it-database</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
</goals>
<configuration>
<images>
<image>
<name>mysql:5.7</name>
<alias>it-database</alias>
<run>
<ports>
<port>it-database.port:5432</port>
</ports>
<wait>
<log>database system is ready to accept connections</log>
<time>20000</time>
</wait>
</run>
</image> …Run Code Online (Sandbox Code Playgroud) 我在 mongo 中保存了一个日期:
"lastUpdate":{
"date":"2014-12-04T16:41:31.394+0100"
},
Run Code Online (Sandbox Code Playgroud)
我想转换为 LocalDate,我尝试过这样的转换器:
@ReadingConverter
public class DateToLocalDateConverter implements Converter<DateTime, LocalDate> {
@Override
public LocalDate convert(DateTime source) {
log.debug("inside");
return new DateTime();
}
}
Run Code Online (Sandbox Code Playgroud)
但我还没有成功。有人可以帮助我吗?
谢谢
我对更新 search.max_buckets 有疑问,因为我收到一些警告,因为聚合创建了太多存储桶,所以我怀疑如果我更新这个值超过 10000,我会提高性能。现在我有一些想要改进的地方。
提前致谢。
我需要从tagit获取值,我该怎么做?在afterTagAdded中,我调用我的控制器并将对象保存在List <>中,但我不知道如何获得该值.我需要发送到这里 - >数据:{user:here id},值(id),我该怎么做?
$('#userNameFriend').tagit({
fieldName: "tags[]",
removeConfirmation: true,
singleField: true,
allowSpaces: true,
placeholderText: 'Name',
tagSource: function ajaxCall(request, response) {
$.ajax({
url: "${pageContext.request.contextPath}/getUserFriends.html",
data: {
term : request.term
},
dataType: "json",
success: function(data) {
response($.map(data.results.list, function(item) {
return{
label:" "+ item.name +" "+item.surname,
value:item.id
};
}));
}
//error: function(error){
//alert("El valor no existe");
//}
});
},
afterTagAdded: function addUser (event,ui){
//Ejecutar llamada al controller para rellenar array con los usuarios elegidos.
//alert("HOLA"+ui.tag.value);
$.ajax({
url:"${pageContext.request.contextPath}/message/fillin.html",
data:{user:here the id},
dataType: "json", …Run Code Online (Sandbox Code Playgroud) spring ×2
caching ×1
docker ×1
fabric8 ×1
java ×1
jquery ×1
maven ×1
mongodb ×1
spring-boot ×1
spring-cache ×1
spring-data ×1