Skip to content

Commit 6cabd68

Browse files
shreyasm11Eugen
authored andcommitted
BAEL-2000 - Shreyas Mahajan - Adding a project for demonstrating Spring Boot Jib Maven Plugin (eugenp#5375)
* BAEL-2000 - Shreyas Mahajan - Adding a project for demonstrating Spring Boot Jib Maven Plugin * BAEL-2000 - Shreyas Mahajan - Incorporating the changes * BAEL-2000 - Shreyas Mahajan - Renaming the module from spring-boot-jib to jib
1 parent 2f01b43 commit 6cabd68

4 files changed

Lines changed: 109 additions & 0 deletions

File tree

‎jib/pom.xml‎

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<artifactId>jib</artifactId>
5+
<version>0.1-SNAPSHOT</version>
6+
<name>jib</name>
7+
8+
<parent>
9+
<artifactId>parent-boot-2</artifactId>
10+
<groupId>com.baeldung</groupId>
11+
<version>0.0.1-SNAPSHOT</version>
12+
<relativePath>../parent-boot-2</relativePath>
13+
</parent>
14+
15+
<dependencies>
16+
<dependency>
17+
<groupId>org.springframework.boot</groupId>
18+
<artifactId>spring-boot-starter-web</artifactId>
19+
</dependency>
20+
</dependencies>
21+
22+
<properties>
23+
<java.version>1.8</java.version>
24+
</properties>
25+
26+
<build>
27+
<plugins>
28+
<plugin>
29+
<groupId>org.springframework.boot</groupId>
30+
<artifactId>spring-boot-maven-plugin</artifactId>
31+
</plugin>
32+
<plugin>
33+
<groupId>com.google.cloud.tools</groupId>
34+
<artifactId>jib-maven-plugin</artifactId>
35+
<version>0.9.10</version>
36+
<configuration>
37+
<to>
38+
<image>registry.hub.docker.com/baeldungjib/jib-spring-boot-app</image>
39+
</to>
40+
</configuration>
41+
</plugin>
42+
</plugins>
43+
</build>
44+
45+
<repositories>
46+
<repository>
47+
<id>spring-releases</id>
48+
<url>https://repo.spring.io/libs-release</url>
49+
</repository>
50+
</repositories>
51+
<pluginRepositories>
52+
<pluginRepository>
53+
<id>spring-releases</id>
54+
<url>https://repo.spring.io/libs-release</url>
55+
</pluginRepository>
56+
</pluginRepositories>
57+
</project>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.baeldung;
2+
3+
import org.springframework.boot.SpringApplication;
4+
import org.springframework.boot.autoconfigure.SpringBootApplication;
5+
6+
@SpringBootApplication
7+
public class Application {
8+
9+
public static void main(String[] args) {
10+
SpringApplication.run(Application.class, args);
11+
}
12+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package com.baeldung;
2+
3+
public class Greeting {
4+
5+
private final long id;
6+
private final String content;
7+
8+
public Greeting(long id, String content) {
9+
this.id = id;
10+
this.content = content;
11+
}
12+
13+
public long getId() {
14+
return id;
15+
}
16+
17+
public String getContent() {
18+
return content;
19+
}
20+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package com.baeldung;
2+
3+
import org.springframework.web.bind.annotation.GetMapping;
4+
import org.springframework.web.bind.annotation.RequestParam;
5+
import org.springframework.web.bind.annotation.RestController;
6+
7+
import java.util.concurrent.atomic.AtomicLong;
8+
9+
@RestController
10+
public class GreetingController {
11+
12+
private static final String template = "Hello Docker, %s!";
13+
private final AtomicLong counter = new AtomicLong();
14+
15+
@GetMapping("/greeting")
16+
public Greeting greeting(@RequestParam(value="name", defaultValue="World") String name) {
17+
return new Greeting(counter.incrementAndGet(),
18+
String.format(template, name));
19+
}
20+
}

0 commit comments

Comments
 (0)