Skip to content

Commit 6a7b510

Browse files
committed
init repo
0 parents  commit 6a7b510

File tree

5 files changed

+160
-0
lines changed

5 files changed

+160
-0
lines changed

.gitignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# idea
2+
.idea
3+
*.iml
4+
dependency-reduced-pom.xml
5+
# maven
6+
target/
7+
build/
8+
*/test/
9+
10+
# logs
11+
logs/
12+
*.log
13+
14+
# jrebel
15+
rebel.xml
16+
17+

Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
FROM openjdk:8-jdk-alpine
2+
ARG JAR_FILE=*.jar
3+
COPY target/${JAR_FILE} app.jar
4+
ENTRYPOINT ["java","-jar","/app.jar"]

pom.xml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
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+
<modelVersion>4.0.0</modelVersion>
6+
<parent>
7+
<groupId>org.springframework.boot</groupId>
8+
<artifactId>spring-boot-starter-parent</artifactId>
9+
<version>2.2.2.RELEASE</version>
10+
<relativePath/> <!-- lookup parent from repository -->
11+
</parent>
12+
<groupId>org.mendora</groupId>
13+
<artifactId>spring-demo</artifactId>
14+
<version>1.0-SNAPSHOT</version>
15+
16+
<properties>
17+
<java.version>1.8</java.version>
18+
<dockerfile-maven-version>1.4.13</dockerfile-maven-version>
19+
<docker.repository>harbor.com</docker.repository>
20+
<docker.image.prefix>library</docker.image.prefix>
21+
</properties>
22+
23+
<dependencies>
24+
<dependency>
25+
<groupId>org.springframework.boot</groupId>
26+
<artifactId>spring-boot-starter-web</artifactId>
27+
</dependency>
28+
29+
<dependency>
30+
<groupId>org.springframework.boot</groupId>
31+
<artifactId>spring-boot-starter-test</artifactId>
32+
<scope>test</scope>
33+
<exclusions>
34+
<exclusion>
35+
<groupId>org.junit.vintage</groupId>
36+
<artifactId>junit-vintage-engine</artifactId>
37+
</exclusion>
38+
</exclusions>
39+
</dependency>
40+
41+
<dependency>
42+
<groupId>io.springfox</groupId>
43+
<artifactId>springfox-swagger2</artifactId>
44+
<version>2.9.2</version>
45+
</dependency>
46+
47+
<dependency>
48+
<groupId>io.springfox</groupId>
49+
<artifactId>springfox-swagger-ui</artifactId>
50+
<version>2.9.2</version>
51+
</dependency>
52+
</dependencies>
53+
54+
<build>
55+
<plugins>
56+
<plugin>
57+
<groupId>org.springframework.boot</groupId>
58+
<artifactId>spring-boot-maven-plugin</artifactId>
59+
</plugin>
60+
61+
62+
<plugin>
63+
<groupId>org.apache.maven.plugins</groupId>
64+
<artifactId>maven-deploy-plugin</artifactId>
65+
<configuration>
66+
<skip>true</skip>
67+
</configuration>
68+
</plugin>
69+
70+
<plugin>
71+
<groupId>com.spotify</groupId>
72+
<artifactId>dockerfile-maven-plugin</artifactId>
73+
<version>${dockerfile-maven-version}</version>
74+
<executions>
75+
<!--<execution>-->
76+
<!--<id>default</id>-->
77+
<!--<goals>-->
78+
<!--<goal>build</goal>-->
79+
<!--<goal>push</goal>-->
80+
<!--</goals>-->
81+
<!--</execution>-->
82+
</executions>
83+
<configuration>
84+
<repository>${docker.repository}/${docker.image.prefix}/${project.artifactId}</repository>
85+
<tag>${project.version}</tag>
86+
<buildArgs>
87+
<JAR_FILE>${project.build.finalName}.jar</JAR_FILE>
88+
</buildArgs>
89+
<useMavenSettingsForAuth>true</useMavenSettingsForAuth>
90+
</configuration>
91+
</plugin>
92+
</plugins>
93+
</build>
94+
</project>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
package org.mendora;
3+
4+
import org.springframework.boot.SpringApplication;
5+
import org.springframework.boot.autoconfigure.SpringBootApplication;
6+
import org.springframework.web.bind.annotation.GetMapping;
7+
import org.springframework.web.bind.annotation.RequestParam;
8+
import org.springframework.web.bind.annotation.RestController;
9+
10+
@SpringBootApplication
11+
@RestController
12+
public class HelloApplication {
13+
14+
public static void main(String[] args) {
15+
SpringApplication.run(HelloApplication.class, args);
16+
}
17+
18+
@GetMapping("/hello")
19+
public String hello(@RequestParam(value = "name", defaultValue = "World") String name) {
20+
return String.format("Hello %s!", name);
21+
}
22+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
2+
package org.mendora.config;
3+
4+
import org.springframework.context.annotation.Bean;
5+
import org.springframework.context.annotation.Configuration;
6+
import springfox.documentation.builders.PathSelectors;
7+
import springfox.documentation.builders.RequestHandlerSelectors;
8+
import springfox.documentation.spi.DocumentationType;
9+
import springfox.documentation.spring.web.plugins.Docket;
10+
import springfox.documentation.swagger2.annotations.EnableSwagger2;
11+
12+
@Configuration
13+
@EnableSwagger2
14+
public class SwaggerConfig {
15+
@Bean
16+
public Docket api() {
17+
return new Docket(DocumentationType.SWAGGER_2)
18+
.select()
19+
.apis(RequestHandlerSelectors.any())
20+
.paths(PathSelectors.any())
21+
.build();
22+
}
23+
}

0 commit comments

Comments
 (0)