-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
7 changed files
with
257 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ build | |
|
||
# ide | ||
.idea | ||
.vscode | ||
|
||
# For MacOs | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
= ```template-java-API``` Documentation | ||
Damien Jaime <djaime@parisnanterre.fr> | ||
|
||
:plantuml: | ||
ifndef::modelsdir[:modelsdir: models] | ||
|
||
== How to install? | ||
|
||
=== Note | ||
|
||
Tested with gradle 8.10.1 and Java 17.0.12 | ||
|
||
=== If you have ```git``` on your computer | ||
|
||
Simply run: | ||
[source,shell] | ||
---- | ||
git clone https://github.com/DaJaime/template-java-API | ||
---- | ||
|
||
=== If you do not have ```git``` on your computer | ||
|
||
Go to https://github.com/DaJaime/template-java-API, get the zipfile and uncompress it. | ||
|
||
== How to run? | ||
|
||
Simply run: | ||
[source, shell] | ||
---- | ||
./gradlew run | ||
---- | ||
|
||
== What does ```template-java-project``` do? | ||
|
||
This project creates a REST API using Spring boot, with a single route returning “Hello”. | ||
|
||
Here is the class diagram. | ||
|
||
First a file included version without style: | ||
|
||
plantuml::src/docs/asciidoc/models/diagram.puml[svg] | ||
|
||
Then an inlined version with style: | ||
|
||
[plantuml, svg, config="src/docs/asciidoc/models/commons.style"] | ||
.App class diagram | ||
---- | ||
@startuml | ||
package fr.parisnanterre { | ||
class App { | ||
+ main(String[] args) | ||
} | ||
package controllers { | ||
class HelloController { | ||
+ getHello() : String | ||
} | ||
} | ||
package models { | ||
class HelloModel { | ||
+ sayHello() : String | ||
} | ||
} | ||
' Relationships | ||
App --> HelloController : "creates" | ||
HelloController --> HelloModel | ||
} | ||
' Adding Spring Boot dependencies to highlight Spring context | ||
package org.springframework { | ||
interface SpringApplication | ||
interface RestController | ||
interface GetMapping | ||
App --> SpringApplication : "run()" | ||
HelloController --> RestController | ||
HelloController --> GetMapping | ||
} | ||
package io.swagger.v3.oas.annotations{ | ||
interface Operation | ||
interface Tag | ||
HelloController --> Operation | ||
HelloController --> Tag | ||
} | ||
@enduml | ||
---- | ||
Here is a part of the API source code (using ```include``` but you can also put it directly): | ||
|
||
[source,java] | ||
.HelloController source code | ||
---- | ||
include::{sourcedir}/fr/parisnanterre/controllers/HelloController.java[indent=0] | ||
---- | ||
|
||
== Last comments | ||
|
||
Let us end with a recommended book, <<ej3>>. | ||
|
||
[bibliography] | ||
== References | ||
|
||
- [[[ej3,1]]] Joshua Bloch. Effective Java, Third Edition. Pearson Education. 2018. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
'Style defined by Benjamin Benni during his PhD thesis' | ||
'Adapted by Sébastien Mosser for INF-5153' | ||
'https://github.com/ace-lectures/pattern-repository/blob/master/commons.style | ||
'consider giving a star to it | ||
|
||
skinparam nodesep 75 | ||
skinparam ranksep 75 | ||
hide empty members | ||
|
||
skinparam noteFontSize 10 | ||
skinparam noteFontName Courier | ||
|
||
skinparam monochrome false | ||
skinparam shadowing false | ||
skinparam roundcorner 10 | ||
skinparam linetype polyline | ||
|
||
skinparam class { | ||
BackgroundColor GhostWhite | ||
ArrowColor Gray | ||
BorderColor Black | ||
fontColor CornFlowerBlue | ||
} | ||
|
||
skinparam state { | ||
BackgroundColor GhostWhite | ||
ArrowColor Gray | ||
BorderColor Black | ||
fontColor CornFlowerBlue | ||
} | ||
|
||
skinparam object { | ||
BackgroundColor GhostWhite | ||
ArrowColor Gray | ||
BorderColor Black | ||
} | ||
|
||
skinparam package<<Layout>> { | ||
borderColor Transparent | ||
backgroundColor Transparent | ||
fontColor Transparent | ||
stereotypeFontColor Transparent | ||
} | ||
|
||
skinparam sequence { | ||
ArrowColor Gray | ||
LifeLineBorderColor CornFlowerBlue | ||
LifeLineBackgroundColor GhostWhite | ||
ParticipantBorderColor CornFlowerBlue | ||
ParticipantBackgroundColor GhostWhite | ||
ActorBorderColor CornFlowerBlue | ||
ActorBackgroundColor GhostWhite | ||
BoxBorderColor CornFlowerBlue | ||
BoxBackgroundColor GhostWhite | ||
} | ||
|
||
skinparam stereotypeCBackgroundColor CornflowerBlue | ||
|
||
hide footbox | ||
hide empty members | ||
|
||
skinparam note { | ||
BackgroundColor GhostWhite | ||
BorderColor CornFlowerBlue | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
@startuml | ||
|
||
package fr.parisnanterre { | ||
class App { | ||
+ main(String[] args) | ||
} | ||
|
||
package controllers { | ||
class HelloController { | ||
+ getHello() : String | ||
} | ||
} | ||
|
||
package models { | ||
class HelloModel { | ||
+ sayHello() : String | ||
} | ||
} | ||
' Relationships | ||
App --> HelloController : "creates" | ||
HelloController --> HelloModel | ||
} | ||
|
||
' Adding Spring Boot dependencies to highlight Spring context | ||
package org.springframework { | ||
interface SpringApplication | ||
interface RestController | ||
interface GetMapping | ||
|
||
App --> SpringApplication : "run()" | ||
HelloController --> RestController | ||
HelloController --> GetMapping | ||
} | ||
|
||
package io.swagger.v3.oas.annotations{ | ||
interface Operation | ||
interface Tag | ||
|
||
HelloController --> Operation | ||
HelloController --> Tag | ||
} | ||
|
||
@enduml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package fr.parisnanterre.models; | ||
|
||
public class HelloModel { | ||
public static String sayHello(){ | ||
return "Hello from API"; | ||
} | ||
} |