Skip to content

Feature/fix docker compose #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,5 @@ services:
timeout: 10s
retries: 5

app:
image: 'springbootneo4jshortestpath:latest'
build:
context: .
dockerfile: Dockerfile
container_name: SpringBootNeo4jShortestPath
depends_on:
neo4j-db:
condition: service_healthy # Wait for neo4j to be ready
links:
- neo4j-db
environment:
NEO4J_URI: bolt://neo4j-db:7687
NEO4J_PASSWORD: 123456

volumes:
app-neo4j-db:
12 changes: 12 additions & 0 deletions src/main/java/com/springshortpath/app/model/City.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import org.springframework.data.neo4j.core.schema.Node;
import org.springframework.data.neo4j.core.schema.Property;
import org.springframework.data.neo4j.core.schema.Relationship;
import org.springframework.data.neo4j.core.support.UUIDStringGenerator;

import java.util.HashSet;
import java.util.Set;
Expand All @@ -19,6 +20,7 @@
public class City {

@Id
@GeneratedValue(GeneratedValue.UUIDGenerator.class)
@Property
private UUID id;

Expand All @@ -31,4 +33,14 @@ public class City {
public City(String name) {
this.name = name;
}

public City withId(UUID id) {
if (this.id.equals(id)) {
return this;
} else {
City newObject = new City(this.name);
newObject.id = id;
return newObject;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public City getByCityName(String cityName) {

@Override
public City saveCity(City city) {
return cityRepository.saveCity(city.getName());
return cityRepository.save(city);
}

@Override
Expand Down