Skip to content

Java - Spring Boot #6

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

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
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
19 changes: 19 additions & 0 deletions examples/java_spring/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM sapmachine:21-jdk-ubuntu

WORKDIR /workspaces/graphql_examples/examples/java_spring

# Update/Upgrade to latest software, add keys and sources, install software
RUN export DEBIAN_FRONTEND=noninteractive && apt update && apt -y upgrade
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive && apt -y install --no-install-recommends \
postgresql-client \
pspg \
libpq-dev

RUN <<EOF cat >> ~/.bashrc

# Default PostgreSQL Connection
# Will automatically connect to the devcontainer's attached PostgreSQL
# database (see "docker-compose.yml") by typing "psql".
export PGHOST=127.0.0.1 PGPORT=30202 PGUSER=postgres
export PAGER=pspg
EOF
43 changes: 43 additions & 0 deletions examples/java_spring/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"name": "java_spring (GraphQL Example)",
"dockerComposeFile": "docker-compose.yml",
"service": "devcontainer",
"workspaceFolder": "/workspaces/graphql_examples/examples/${localWorkspaceFolderBasename}",
"remoteUser": "root",
// "postCreateCommand": "",
"forwardPorts": [
30201,
30202
],
"portsAttributes": {
"30201": {
"label": "spring"
},
"30202": {
"label": "psql"
}
},
"otherPortsAttributes": {
"onAutoForward": "ignore"
},
"customizations": {
"vscode": {
"extensions": [
"ms-vscode-remote.remote-containers",
"esbenp.prettier-vscode",
"rvest.vs-code-prettier-eslint",
"wmaurer.change-case",
"mquandalle.graphql",
"yzhang.markdown-all-in-one",
"darkriszty.markdown-table-prettify",
"trybick.terminal-zoom",
"netcorext.uuid-generator",
"redhat.vscode-yaml",
"ms-azuretools.vscode-docker",
"vscjava.vscode-java-pack",
"vmware.vscode-boot-dev-pack",
"vscjava.vscode-gradle"
]
}
}
}
29 changes: 29 additions & 0 deletions examples/java_spring/.devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
version: '3'

name: graphql_example-java_spring

services:
devcontainer:
build:
context: .
dockerfile: Dockerfile
ports:
- 30201
volumes:
- ../../../..:/workspaces:cached
command: sleep infinity
network_mode: host

postgres:
image: postgres:15.1
restart: unless-stopped
ports:
- 30202:5432
volumes:
- postgres-data:/var/lib/postgresql/data
environment:
POSTGRES_USER: postgres
POSTGRES_HOST_AUTH_METHOD: trust

volumes:
postgres-data:
1 change: 1 addition & 0 deletions examples/java_spring/.editorconfig
1 change: 1 addition & 0 deletions examples/java_spring/.eslintrc.js
34 changes: 34 additions & 0 deletions examples/java_spring/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
HELP.md
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
1 change: 1 addition & 0 deletions examples/java_spring/.prettierrc
7 changes: 7 additions & 0 deletions examples/java_spring/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"recommendations": [
"vscjava.vscode-java-pack",
"vmware.vscode-boot-dev-pack",
"vscjava.vscode-gradle"
]
}
4 changes: 4 additions & 0 deletions examples/java_spring/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"java.compile.nullAnalysis.mode": "automatic",
"java.configuration.updateBuildConfiguration": "automatic"
}
7 changes: 7 additions & 0 deletions examples/java_spring/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# java_spring

## Stack

- Java (OpenJDK 21)
- Spring Boot

29 changes: 29 additions & 0 deletions examples/java_spring/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
plugins {
id 'java'
id 'org.springframework.boot' version '3.2.0'
id 'io.spring.dependency-management' version '1.1.4'
}

group = 'net.adeynack.graphql_examples.java_spring'
version = '0.0.1-SNAPSHOT'

java {
sourceCompatibility = '21'
}

repositories {
mavenCentral()
}

dependencies {
implementation 'org.springframework.boot:spring-boot-starter-graphql'
implementation 'org.springframework.boot:spring-boot-starter-web'
runtimeOnly 'org.postgresql:postgresql'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework:spring-webflux'
testImplementation 'org.springframework.graphql:spring-graphql-test'
}

tasks.named('test') {
useJUnitPlatform()
}
Binary file not shown.
7 changes: 7 additions & 0 deletions examples/java_spring/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading