File tree Expand file tree Collapse file tree
src/main/java/com/baeldung Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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 >
Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments