File tree Expand file tree Collapse file tree
java/io/github/javaasasecondlanguage/cloud Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ .gradle /
2+ /gradle /
3+ /out /
4+ build /
5+ /classes
6+
7+ .idea
8+ * .iml
9+ gradlew
10+ gradlew.bat
Original file line number Diff line number Diff line change 1+ FROM x86_64-alpine-jdk-14.0.2_12-slim
2+ EXPOSE 8080
3+
4+ ARG JAR_FILE=build/libs/*.jar
5+ COPY ${JAR_FILE} cloud.jar
6+ ENTRYPOINT ["java" ,"-jar" ,"/cloud.jar" ]
Original file line number Diff line number Diff line change 1+ group = " io.github.javaasasecondlanguage"
2+ version = " 1.0-SNAPSHOT"
3+
4+ plugins {
5+ java
6+ checkstyle
7+ id(" org.springframework.boot" ) version " 2.2.0.RELEASE"
8+ id(" io.spring.dependency-management" ) version " 1.0.8.RELEASE"
9+ }
10+
11+ java {
12+ sourceCompatibility = JavaVersion .VERSION_14
13+ targetCompatibility = JavaVersion .VERSION_14
14+ }
15+
16+ enableJavaPreviewFeatures()
17+
18+ repositories {
19+ mavenCentral()
20+ }
21+
22+ dependencies {
23+ implementation(" org.springframework.boot:spring-boot-starter-web" )
24+ implementation(" org.springframework.boot:spring-boot-starter-actuator" )
25+ testImplementation(" org.junit.jupiter:junit-jupiter-api:5.3.1" )
26+ testRuntimeOnly(" org.junit.jupiter:junit-jupiter-engine:5.3.1" )
27+ }
28+
29+ checkstyle {
30+ toolVersion = " 8.36.1"
31+ config = resources.text.fromFile(" ../../config/checkstyle/checkstyle.xml" )
32+ }
33+
34+ tasks.withType<Checkstyle > {
35+ reports {
36+ xml.isEnabled = false
37+ html.isEnabled = true
38+ }
39+ }
40+
41+ fun enableJavaPreviewFeatures () {
42+ tasks.withType<JavaCompile > {
43+ options.compilerArgs.add(" --enable-preview" )
44+ }
45+
46+ tasks.withType<Test >().configureEach {
47+ useJUnitPlatform()
48+ jvmArgs(" --enable-preview" )
49+ }
50+ }
Original file line number Diff line number Diff line change 1+ rootProject.name = " cloud"
Original file line number Diff line number Diff line change 1+ package io .github .javaasasecondlanguage .cloud ;
2+
3+ import org .springframework .http .HttpStatus ;
4+ import org .springframework .http .MediaType ;
5+ import org .springframework .http .ResponseEntity ;
6+ import org .springframework .stereotype .Controller ;
7+ import org .springframework .web .bind .annotation .RequestMapping ;
8+ import org .springframework .web .bind .annotation .RequestMethod ;
9+ import org .springframework .web .bind .annotation .RequestParam ;
10+ import org .springframework .web .bind .annotation .ResponseStatus ;
11+
12+ import java .util .HashMap ;
13+ import java .util .Map ;
14+
15+ /**
16+ * Broken implementation of billing service
17+ * Money are lost here
18+ */
19+ @ Controller
20+ public class CloudResource {
21+ /**
22+ * curl localhost:8080/status
23+ */
24+ @ RequestMapping (
25+ path = "status" ,
26+ method = RequestMethod .GET ,
27+ produces = MediaType .TEXT_PLAIN_VALUE )
28+ public ResponseEntity <String > status () {
29+ return ResponseEntity .ok ("It's working!" );
30+ }
31+ }
Original file line number Diff line number Diff line change 1+ package io .github .javaasasecondlanguage .cloud ;
2+
3+ import org .springframework .boot .SpringApplication ;
4+ import org .springframework .boot .autoconfigure .SpringBootApplication ;
5+
6+ @ SpringBootApplication
7+ public class CloudServer {
8+ public static void main (String [] args ) {
9+ SpringApplication .run (CloudServer .class , args );
10+ }
11+ }
Original file line number Diff line number Diff line change 1+ management.endpoints.web.exposure.include =*
You can’t perform that action at this time.
0 commit comments