我正在开发一个计划将elasticsearch用作数据存储库的系统.我正在尝试选择开发我的应用程序的最佳方法,该应用程序可以索引和查询elasticsearch中的数据.我拥有的系统建立在Spring框架之上.
使用Spring-data-elasticsearch(https://github.com/spring-projects/spring-data-elasticsearch)是一个不错的选择吗?
或者使用elasticsearch核心库本身是一个不错的选择?
我需要处理嵌套数据(内部对象),但Spring-data-elasticsearch最近似乎没有操作.
我希望我能找到问题的解决方案.提前致谢.
java spring frameworks elasticsearch spring-data-elasticsearch
我正在用一个json体调用aws lambda.所以json的字段与POJO中的字段名称不同.所以我做的是在字段上添加@JsonProperty告诉jackson json中的名字是什么.但由于某种原因,它似乎无法识别它们并且所有字段都为空.如果我传递一个与POJO具有相同字段名称的json,它正在工作.这是我的班级:
public class Event implements Identifiable {
@JsonProperty("distinct_id")
private String distinctId;
@JsonProperty("user_id")
private Integer userId;
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
@JsonSerialize(using = LocalDateTimeSerializer.class)
private LocalDateTime eventDateTime;
//Here are the getters and setters
}
Run Code Online (Sandbox Code Playgroud)
如果我通过
{"distinct_id":"123", "user_id":123, "dt":"2017-01-04T08:45:04+00:00"}
Run Code Online (Sandbox Code Playgroud)
所有字段都为null,并且使用distinctId,userId,eventDateTime,它正在序列化,但它也无法识别我的自定义序列化器/反序列化器,但这实际上是同样的问题.
我的结论是,由于某些原因,aws jackson没有使用注释,但它没有意义.
我想将我的IntelliJ配置文件保存在我的dotfiles repo中,但我的~/.IntelliJIdea2016.1文件夹权重> 1.3G :(
~/.IntelliJIdea2016.1/config/ 仍然重量> 215M ......
~/.IntelliJIdea2016.1/config/plugins/ 包含大量的二进制文件...不是dotfiles的最佳候选者:(
有人试图在没有Export/Import settings菜单选项的情况下保存IntelliJ配置?
在Hibernate参考书的第21章中,我有一个基本的一对多关系父/子.
级联仅从子级到父级(持久化级联仅因为我不想删除父项,如果我删除子级).
当我向父母添加一个孩子并保存孩子时,我有一个TransientObjectException ...
@Entity
public class Parent implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@OneToMany(mappedBy = "parent", orphanRemoval = true)
private List<Child> childs;
public List<Child> getChilds() {
return childs;
}
public void setChilds(List<Child> childs) {
this.childs = childs;
}
public void addChild(Child child) {
if (childs == null) childs = new ArrayList<Child>();
if (childs.add(child)) child.setParent(this);
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
}
@Entity
public class …Run Code Online (Sandbox Code Playgroud) 我有几个由经典Docker命令启动的运行容器.这些容器使用的是Docker网络,也是"手动"创建的:
docker network create simple-network
docker run -d \
--name docker-registry \
--net=simple-network \
-p 5000:5000 \
-v [...] \
registry:2.3.0
docker run -d \
--name docker-registry-web \
--net=simple-network \
-p 8080 \
-v [...] \
hyper/docker-registry-web
docker run -d \
--name nginx \
--net=simple-network \
-p 80:80 \
-p 443:443 \
-v [...] \
nginx:1.9.8
Run Code Online (Sandbox Code Playgroud)
我想使用Docker Compose来运行这些容器,因为它更容易管理.
是否可以将这些容器迁移到Docker Compose,如下所示,或者只能使用新的容器进行组合?
我希望在迁移过程中使用相同的卷!停机不是问题.
泊坞窗,compose.yml
version: '2'
docker-registry:
image: registry:2.3.0
ports:
- "5000:5000"
volumes:
- [...]
docker-registry-web:
image: hyper/docker-registry-web
expose:
- "8080"
volumes: …Run Code Online (Sandbox Code Playgroud) 我正在使用Maven多模块与战争取决于另一场战争.
Spring Boot webapp依赖于仅提供html文件的基本webapp.
当我运行Spring Boot应用程序时,我能够从主webapp(Spring Boot)访问服务和html,但我无法从依赖战争中访问html文件(404).但是这些html文件很好地打包在Spring Boot webapp war中......
这是一个显示问题的项目:https:
//github.com/cthiebault/spring-boot-war-overlays
这个项目有2个战争模块:
这是main-webapp pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>spring-boot-overlays</groupId>
<artifactId>parent</artifactId>
<version>0.1.0-SNAPSHOT</version>
</parent>
<artifactId>main-webapp</artifactId>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>spring-boot-overlays</groupId>
<artifactId>dependency-webapp</artifactId>
<version>0.1.0-SNAPSHOT</version>
<type>war</type>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<overlays>
<overlay>
<groupId>spring-boot-overlays</groupId>
<artifactId>dependency-webapp</artifactId>
</overlay>
</overlays>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<start-class>hello.Application</start-class>
</properties>
</project> …Run Code Online (Sandbox Code Playgroud) 我无法用Jenkins Pipeline将ocker图像推送到Amazon ECR:我总是得到no basic auth credentials:-(
这是我的设置:
aws-jenkins到Jenkins(在本地测试并成功推送到AWS ECR)/root/.dockercfg到我的调试authJenkinsfileJenkinsfile:
stage("Docker") {
dir(path) {
docker.build("my-image:latest")
}
docker.withRegistry("https://<my-aws-id>.dkr.ecr.eu-central-1.amazonaws.com", "ecr:eu-central-1:aws-jenkins") {
sh "cat /root/.dockercfg" // debug
docker.image("my-image:latest").push()
}
}
Run Code Online (Sandbox Code Playgroud)
日志:
[Pipeline] withDockerRegistry
Wrote authentication to /root/.dockercfg
[Pipeline] {
[Pipeline] sh
[docker-emotion-compilers] Running shell script
+ cat /root/.dockercfg
{"https://<my-aws-id>.dkr.ecr.eu-central-1.amazonaws.com": {
"auth": "[...]",
"email": "nobody@example.com"
}}[Pipeline] sh
[docker-emotion-compilers] Running shell script
+ docker tag --force=true my-image:latest <my-aws-id>.dkr.ecr.eu-central-1.amazonaws.com/my-image:latest
Warning: '--force' is deprecated, it will …Run Code Online (Sandbox Code Playgroud) java ×3
amazon-ecr ×1
aws-lambda ×1
cascade ×1
docker ×1
dotfiles ×1
frameworks ×1
hibernate ×1
jackson ×1
jenkins ×1
maven ×1
one-to-many ×1
orphan ×1
spring ×1
spring-boot ×1