Skip to content

Commit 0c6d3f2

Browse files
iluwatar#297 Create Spring Boot-backed Image microservice with an endpoint to retrieve an image path
1 parent 3cbb88e commit 0c6d3f2

File tree

4 files changed

+112
-0
lines changed

4 files changed

+112
-0
lines changed
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<parent>
6+
<relativePath>../../pom.xml</relativePath>
7+
<artifactId>java-design-patterns</artifactId>
8+
<groupId>com.iluwatar</groupId>
9+
<version>1.10.0-SNAPSHOT</version>
10+
</parent>
11+
12+
<modelVersion>4.0.0</modelVersion>
13+
<artifactId>image-microservice</artifactId>
14+
<packaging>jar</packaging>
15+
16+
<properties>
17+
<spring.version>4.2.5.RELEASE</spring.version>
18+
<spring-boot.version>1.3.3.RELEASE</spring-boot.version>
19+
</properties>
20+
21+
<dependencyManagement>
22+
<dependencies>
23+
<dependency>
24+
<groupId>org.springframework.boot</groupId>
25+
<artifactId>spring-boot-dependencies</artifactId>
26+
<version>${spring-boot.version}</version>
27+
<type>pom</type>
28+
<scope>import</scope>
29+
</dependency>
30+
</dependencies>
31+
</dependencyManagement>
32+
<dependencies>
33+
<dependency>
34+
<groupId>org.springframework</groupId>
35+
<artifactId>spring-webmvc</artifactId>
36+
<version>${spring.version}</version>
37+
</dependency>
38+
<dependency>
39+
<groupId>org.springframework.boot</groupId>
40+
<artifactId>spring-boot-starter-web</artifactId>
41+
<version>${spring-boot.version}</version>
42+
</dependency>
43+
</dependencies>
44+
45+
<build>
46+
<plugins>
47+
<plugin>
48+
<groupId>org.springframework.boot</groupId>
49+
<artifactId>spring-boot-maven-plugin</artifactId>
50+
<version>${spring-boot.version}</version>
51+
<executions>
52+
<execution>
53+
<goals>
54+
<goal>repackage</goal>
55+
</goals>
56+
</execution>
57+
</executions>
58+
</plugin>
59+
</plugins>
60+
</build>
61+
62+
<!--<dependencies>-->
63+
<!--<dependency>-->
64+
<!--<groupId>junit</groupId>-->
65+
<!--<artifactId>junit</artifactId>-->
66+
<!--<scope>test</scope>-->
67+
<!--</dependency>-->
68+
<!--</dependencies>-->
69+
</project>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package com.iluwatar.image.microservice;
2+
3+
import org.springframework.boot.SpringApplication;
4+
import org.springframework.boot.autoconfigure.SpringBootApplication;
5+
6+
/**
7+
* ImageApplication starts up Spring Boot, exposing endpoints for the Image microservice through
8+
* the {@link ImageController}.
9+
*/
10+
@SpringBootApplication
11+
public class ImageApplication {
12+
13+
/**
14+
* Microservice entry point
15+
* @param args
16+
* command line args
17+
*/
18+
public static void main(String[] args) {
19+
SpringApplication.run(ImageApplication.class, args);
20+
}
21+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package com.iluwatar.image.microservice;
2+
3+
import org.springframework.web.bind.annotation.RequestMapping;
4+
import org.springframework.web.bind.annotation.RequestMethod;
5+
import org.springframework.web.bind.annotation.RestController;
6+
7+
/**
8+
* Exposes the Image microservice's endpoints
9+
*/
10+
@RestController
11+
public class ImageController {
12+
13+
/**
14+
* An endpoint for a user to retrieve an image path
15+
* @return An image path
16+
*/
17+
@RequestMapping(value = "/image-path", method = RequestMethod.GET)
18+
public String getImagePath() {
19+
return "/product-image.png";
20+
}
21+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
server.port=50005

0 commit comments

Comments
 (0)