Skip to content

Commit c3d6a19

Browse files
author
JesusGuzmanJr
committed
create directories
1 parent 5e23af1 commit c3d6a19

26 files changed

+965
-0
lines changed

Diff for: .gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
**/.DS_Store
2+
.config
3+
.certs

Diff for: .vscode/settings.json

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"cSpell.words": [
3+
"actix",
4+
"blazingly",
5+
"bytecode",
6+
"clippy",
7+
"createdb",
8+
"devel",
9+
"epyc",
10+
"footguns",
11+
"initializer",
12+
"jdks",
13+
"libexec",
14+
"musl",
15+
"nightlies",
16+
"openjdk",
17+
"postgres",
18+
"postgresql",
19+
"rustc",
20+
"rustfmt",
21+
"rustup",
22+
"servlet",
23+
"sqlx",
24+
"symlink",
25+
"toolchain",
26+
"toolchains"
27+
],
28+
"java.checkstyle.configuration": "/google_checks.xml"
29+
}

Diff for: README.md

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Java & Rust Comparison of a Restful Service
2+
3+
This repository showcases two implementations of a restful api service. Its intent is to enable Java practitioners to compare and contrast a web service implemented in both languages. Both servers are reachable and running in production.
4+
___
5+
## About the tech stacks
6+
7+
### ☕️ Why Java?
8+
Many companies use Java for its ease-of-use and mature libraries.
9+
Java's strongest feature is its object-oriented paradigm that enables developers to model their business logic as a hierarchy of objects.
10+
11+
### 🦀 Why Rust?
12+
Rust earned the top spot as the “most-loved” programming language for the fifth consecutive year of [Stack Overflow’s developer survey]. The Rust ecosystem has recently seen an explosion in adoption with backing from [major companies]. Rust's most unique feature is the borrow checker, a compilation step that validates references and reclaims inaccessible memory thereby eliminating the need for a runtime garbage collector. This enables Rust programs to be blazingly fast and memory-efficient.
13+
14+
[Stack Overflow’s developer survey]: https://stackoverflow.blog/2020/06/05/why-the-developers-who-use-rust-love-it-so-much/
15+
[major companies]: https://foundation.rust-lang.org/members/
16+
17+
### Stack Comparison
18+
19+
| Stack | Java | Rust |
20+
| ------------------ | ------------------------------------------------------ | -------------------------------------------- |
21+
| domain name | java-car-rentals.marzipan.club | rust-car-rentals.marzipan.club |
22+
| health endpoint | https://java-car-rentals.marzipan.club/health | https://rust-car-rental.marzipan.club/health |
23+
| language | [Java SE 8] ([OpenJDK 8 8u292-b10]) | [Rust 2018] ([1.53.0]) |
24+
| compiler | java-1.8.0-openjdk-devel | rustc 1.53.0 (53cb7b09b 2021-06-17) |
25+
| compilation target | java bytecode 52.0 | x86_64-unknown-linux-musl |
26+
| runtime | [OpenJDK] ([java-1.8.0-openjdk]) | [Tokio] ([0.2.25]) |
27+
| web framework | [Apache Tomcat] ([8.5.69]) and [Spring Boot] ([2.5.2]) | [Actix Web] ([3.3.2]) |
28+
| package manager | mvn | cargo |
29+
| manifest file | pom.xml | cargo.toml |
30+
31+
[Java SE 8]: https://docs.oracle.com/javase/8
32+
[OpenJDK 8 8u292-b10]: https://mail.openjdk.java.net/pipermail/jdk8u-dev/2021-April/013680.html
33+
34+
[Rust 2018]: https://www.rust-lang.org
35+
[1.53.0]: https://blog.rust-lang.org/2021/06/17/Rust-1.53.0.html
36+
37+
[OpenJDK]: https://openjdk.java.net
38+
[java-1.8.0-openjdk]: https://openjdk.java.net/install
39+
40+
[Tokio]:https://tokio.rs
41+
[0.2.25]: https://crates.io/crates/tokio/0.2.25
42+
43+
[Apache Tomcat]: https://tomcat.apache.org
44+
[8.5.69]: https://tomcat.apache.org/download-80.cgi#8.5.69
45+
46+
[Spring Boot]: https://spring.io
47+
[2.5.2]: https://github.com/spring-projects/spring-boot/tree/v2.5.2
48+
49+
[Actix Web]: https://actix.rs
50+
[3.3.2]: https://crates.io/crates/actix-web/3.3.2
51+
52+
---
53+
### Machine Specs
54+
| | |
55+
| ---- | -------------------------- |
56+
| os | Fedora 34 |
57+
| cpu | 2 vCPU (AMD EPYC 2nd Gen) |
58+
| ram | 2 GB |
59+
| disk | 40 GB |

Diff for: java/.classpath

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" output="target/classes" path="src/main/java">
4+
<attributes>
5+
<attribute name="optional" value="true"/>
6+
<attribute name="maven.pomderived" value="true"/>
7+
</attributes>
8+
</classpathentry>
9+
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
10+
<attributes>
11+
<attribute name="maven.pomderived" value="true"/>
12+
</attributes>
13+
</classpathentry>
14+
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
15+
<attributes>
16+
<attribute name="optional" value="true"/>
17+
<attribute name="maven.pomderived" value="true"/>
18+
<attribute name="test" value="true"/>
19+
</attributes>
20+
</classpathentry>
21+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
22+
<attributes>
23+
<attribute name="maven.pomderived" value="true"/>
24+
</attributes>
25+
</classpathentry>
26+
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
27+
<attributes>
28+
<attribute name="maven.pomderived" value="true"/>
29+
</attributes>
30+
</classpathentry>
31+
<classpathentry kind="src" path="target/generated-sources/annotations">
32+
<attributes>
33+
<attribute name="optional" value="true"/>
34+
<attribute name="maven.pomderived" value="true"/>
35+
<attribute name="ignore_optional_problems" value="true"/>
36+
<attribute name="m2e-apt" value="true"/>
37+
</attributes>
38+
</classpathentry>
39+
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
40+
<attributes>
41+
<attribute name="optional" value="true"/>
42+
<attribute name="maven.pomderived" value="true"/>
43+
<attribute name="ignore_optional_problems" value="true"/>
44+
<attribute name="m2e-apt" value="true"/>
45+
<attribute name="test" value="true"/>
46+
</attributes>
47+
</classpathentry>
48+
<classpathentry kind="output" path="target/classes"/>
49+
</classpath>

Diff for: java/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/target

Diff for: java/.project

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>car-rentals</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>org.eclipse.m2e.core.maven2Builder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
</buildSpec>
19+
<natures>
20+
<nature>org.eclipse.jdt.core.javanature</nature>
21+
<nature>org.eclipse.m2e.core.maven2Nature</nature>
22+
</natures>
23+
<filteredResources>
24+
<filter>
25+
<id>1626863960485</id>
26+
<name></name>
27+
<type>30</type>
28+
<matcher>
29+
<id>org.eclipse.core.resources.regexFilterMatcher</id>
30+
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
31+
</matcher>
32+
</filter>
33+
</filteredResources>
34+
</projectDescription>

Diff for: java/.settings/org.eclipse.core.resources.prefs

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
eclipse.preferences.version=1
2+
encoding//src/main/java=UTF-8
3+
encoding//src/main/resources=UTF-8
4+
encoding//src/test/java=UTF-8
5+
encoding/<project>=UTF-8

Diff for: java/.settings/org.eclipse.jdt.apt.core.prefs

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.apt.aptEnabled=false

Diff for: java/.settings/org.eclipse.jdt.core.prefs

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.codegen.methodParameters=generate
3+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
4+
org.eclipse.jdt.core.compiler.compliance=1.8
5+
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
6+
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
7+
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
8+
org.eclipse.jdt.core.compiler.processAnnotations=disabled
9+
org.eclipse.jdt.core.compiler.release=disabled
10+
org.eclipse.jdt.core.compiler.source=1.8

Diff for: java/.settings/org.eclipse.m2e.core.prefs

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
activeProfiles=
2+
eclipse.preferences.version=1
3+
resolveWorkspaceProjects=true
4+
version=1

Diff for: java/Dockerfile

Whitespace-only changes.

Diff for: java/README.md

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Java Implementation
2+
3+
## Setup
4+
5+
### Java
6+
7+
Install the Java development kits. Java 11 is required by the Language Support for Java by Red Had VSCode extension.
8+
9+
brew install openjdk@8
10+
brew install openjdk@11
11+
12+
Open VSCode's settings with `Cmd + Shift + P``Preference: Open SEttings (JSON)` and add the following settings
13+
14+
```json
15+
"java.configuration.runtimes": [
16+
{
17+
"name": "JavaSE-1.8",
18+
"path": "/usr/local/opt/openjdk@8/libexec/openjdk.jdk/Contents/Home",
19+
}
20+
],
21+
```
22+
23+
For the system Java wrappers to find the JDKs, symlink them.
24+
25+
sudo ln -sfn /usr/local/opt/openjdk@8/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-8.jdk
26+
27+
sudo ln -sfn /usr/local/opt/openjdk@11/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-11.jdk
28+
29+
30+
31+
Install the package manager.
32+
33+
brew install maven
34+
35+
Install the web server.
36+
37+
brew install tomcat
38+
## Development
39+
Make a build.
40+
41+
mvn compile
42+
43+
Run unit tests run.
44+
45+
mvn test
46+
47+
Make a production build.
48+
49+
mvn package
50+
51+
Clear build artifacts.
52+
53+
mvn clean
54+
55+
Make a production build image.
56+
57+
docker build -t java-car-rentals:latest
58+
59+
Run an ephemeral docker container.
60+
61+
docker run --rm -it java-car-rentals:latest

0 commit comments

Comments
 (0)