Skip to content

Commit 944115f

Browse files
committed
temp rest service and sagger set up
1 parent f958b92 commit 944115f

File tree

11 files changed

+140
-18
lines changed

11 files changed

+140
-18
lines changed

pom.xml

+32-15
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,11 @@
1414
<version>0.0.1-SNAPSHOT</version>
1515
<name>metmesh</name>
1616
<description>Demo project for Spring Boot</description>
17-
<url/>
18-
<licenses>
19-
<license/>
20-
</licenses>
21-
<developers>
22-
<developer/>
23-
</developers>
24-
<scm>
25-
<connection/>
26-
<developerConnection/>
27-
<tag/>
28-
<url/>
29-
</scm>
17+
3018
<properties>
31-
<java.version>21</java.version>
19+
<java.version>21</java.version>
3220
</properties>
21+
3322
<dependencies>
3423
<dependency>
3524
<groupId>org.springframework.boot</groupId>
@@ -45,16 +34,27 @@
4534
<dependency>
4635
<groupId>org.projectlombok</groupId>
4736
<artifactId>lombok</artifactId>
48-
<optional>true</optional>
4937
</dependency>
5038
<dependency>
5139
<groupId>org.springframework.boot</groupId>
5240
<artifactId>spring-boot-starter-test</artifactId>
5341
<scope>test</scope>
5442
</dependency>
43+
<dependency>
44+
<groupId>org.springdoc</groupId>
45+
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
46+
<version>2.0.3</version>
47+
</dependency>
48+
49+
<dependency>
50+
<groupId>io.swagger.core.v3</groupId>
51+
<artifactId>swagger-annotations</artifactId>
52+
<version>2.2.16</version>
53+
</dependency>
5554
</dependencies>
5655

5756
<build>
57+
5858
<plugins>
5959
<plugin>
6060
<groupId>org.springframework.boot</groupId>
@@ -68,10 +68,27 @@
6868
</excludes>
6969
</configuration>
7070
</plugin>
71+
<plugin>
72+
<groupId>org.apache.maven.plugins</groupId>
73+
<artifactId>maven-compiler-plugin</artifactId>
74+
<version>3.8.1</version>
75+
<configuration>
76+
<release>21</release>
77+
<annotationProcessorPaths>
78+
<path>
79+
<groupId>org.projectlombok</groupId>
80+
<artifactId>lombok</artifactId>
81+
<version>${lombok.version}</version>
82+
</path>
83+
</annotationProcessorPaths>
84+
</configuration>
85+
</plugin>
7186
</plugins>
7287

7388
<finalName>metmesh</finalName>
7489

7590
</build>
7691

92+
93+
7794
</project>

src/main/java/com/github/joe_mccarthy/metmesh/MetmeshApplication.java renamed to src/main/java/com/github/joemccarthy/metmesh/MetmeshApplication.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.github.joe_mccarthy.metmesh;
1+
package com.github.joemccarthy.metmesh;
22

33
import org.springframework.boot.SpringApplication;
44
import org.springframework.boot.autoconfigure.SpringBootApplication;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package com.github.joemccarthy.metmesh.configuration;
2+
3+
import org.springframework.context.annotation.Configuration;
4+
5+
@Configuration
6+
public class ApplicationConfiguration {
7+
8+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package com.github.joemccarthy.metmesh.configuration;
2+
3+
import org.springframework.context.annotation.Configuration;
4+
import org.springframework.scheduling.annotation.EnableScheduling;
5+
6+
@Configuration
7+
@EnableScheduling
8+
public class SchedulerConfiguration {
9+
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.github.joemccarthy.metmesh.configuration;
2+
3+
import io.swagger.v3.oas.annotations.OpenAPIDefinition;
4+
import io.swagger.v3.oas.annotations.info.Info;
5+
import io.swagger.v3.oas.annotations.info.License;
6+
7+
import io.swagger.v3.oas.annotations.info.Contact;
8+
9+
@OpenAPIDefinition(
10+
info = @Info(title = SwaggerConstants.API_TITLE,
11+
version = SwaggerConstants.API_VERSION, description = SwaggerConstants.API_DESCRIPTION,
12+
license = @License(name = SwaggerConstants.SwaggerLicence.NAME, url = SwaggerConstants.SwaggerLicence.URL),
13+
contact = @Contact(name = SwaggerConstants.SwaggerContact.NAME, email = SwaggerConstants.SwaggerContact.EMAIL,
14+
url = SwaggerConstants.SwaggerContact.URL)))
15+
public class SwaggerConfiguration {
16+
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.github.joemccarthy.metmesh.configuration;
2+
3+
public class SwaggerConstants {
4+
5+
public final static String API_TITLE = "MetMesh API";
6+
public final static String API_VERSION = "1.0.0";
7+
public final static String API_DESCRIPTION = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum odio dui, accumsan et dictum sed, mollis vel augue. Integer at mauris sem. Nam non faucibus orci. Nunc vel porttitor arcu. Aliquam sagittis a dolor id tempus. Donec eget augue justo. Duis bibendum magna gravida erat luctus, nec malesuada nulla cursus. Nulla egestas convallis odio, vel pulvinar augue pretium sed.";
8+
9+
public class SwaggerLicence {
10+
public final static String NAME = "LGPL-2.1-1";
11+
public final static String URL = "https://opensource.org/license/lgpl-2-1";
12+
}
13+
14+
public class SwaggerContact {
15+
public final static String NAME = "Random Person";
16+
public final static String EMAIL = "[email protected]";
17+
public final static String URL = "https://example.com";
18+
}
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package com.github.joemccarthy.metmesh.services.server;
2+
3+
import org.springframework.http.ResponseEntity;
4+
import org.springframework.web.bind.annotation.GetMapping;
5+
import org.springframework.web.bind.annotation.RestController;
6+
7+
import com.github.joemccarthy.metmesh.services.server.delegate.ServerDelegate;
8+
import com.github.joemccarthy.metmesh.services.server.dto.ServerDTO;
9+
10+
11+
import lombok.RequiredArgsConstructor;
12+
13+
14+
@RestController
15+
@RequiredArgsConstructor
16+
public class ServerRestController {
17+
18+
private final ServerDelegate serverDelegate;
19+
20+
@GetMapping(path = "/api/v1/server")
21+
public ResponseEntity<ServerDTO> getMethodName() {
22+
return ResponseEntity.ok(ServerDTO.builder().name(serverDelegate.getMethodName()).build());
23+
}
24+
25+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.github.joemccarthy.metmesh.services.server.delegate;
2+
3+
import org.springframework.stereotype.Component;
4+
5+
@Component
6+
public class ServerDelegate {
7+
8+
public String getMethodName() {
9+
return "getMethodName";
10+
}
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.github.joemccarthy.metmesh.services.server.dto;
2+
3+
import lombok.AllArgsConstructor;
4+
import lombok.Builder;
5+
import lombok.Data;
6+
import lombok.NoArgsConstructor;
7+
8+
@Builder
9+
@Data
10+
@NoArgsConstructor
11+
@AllArgsConstructor
12+
public class ServerDTO {
13+
14+
private String name;
15+
}

src/main/resources/application.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ server:
33

44
spring:
55
application:
6-
name: metmesh
6+
name: metmesh

src/test/java/com/github/joe_mccarthy/metmesh/MetmeshApplicationTests.java renamed to src/test/java/com/github/joemccarthy/metmesh/MetmeshApplicationTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.github.joe_mccarthy.metmesh;
1+
package com.github.joemccarthy.metmesh;
22

33
import org.junit.jupiter.api.Test;
44
import org.springframework.boot.test.context.SpringBootTest;

0 commit comments

Comments
 (0)