Skip to content

Commit c51cd0c

Browse files
committed
[bugfix] minor bugfixes during review
1 parent 977f27a commit c51cd0c

7 files changed

Lines changed: 24 additions & 22 deletions

File tree

pom.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,13 @@
100100
</dependencies>
101101

102102
<build>
103+
<resources>
104+
<resource>
105+
<directory>src/main/resources</directory>
106+
<filtering>true</filtering>
107+
</resource>
108+
</resources>
109+
103110
<plugins>
104111
<!-- Maven Compiler Plugin -->
105112
<plugin>

src/main/java/com/evolvedbinary/bblValidator/controller/SchemaController.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,15 @@
77
import io.micronaut.http.annotation.Get;
88
import io.micronaut.http.annotation.Produces;
99
import io.micronaut.http.annotation.PathVariable;
10+
import jakarta.inject.Inject;
1011

1112
import java.util.List;
1213

1314
@Controller("/schema")
1415
public class SchemaController {
1516

16-
private final SchemaService schemaService;
17-
18-
public SchemaController(SchemaService schemaService) {
19-
this.schemaService = schemaService;
20-
}
17+
@Inject
18+
SchemaService schemaService;
2119

2220
@Get
2321
@Produces(MediaType.APPLICATION_JSON)

src/main/java/com/evolvedbinary/bblValidator/controller/ValidateController.java

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import io.micronaut.http.annotation.Controller;
1010
import io.micronaut.http.annotation.Post;
1111
import io.micronaut.http.annotation.QueryValue;
12+
import jakarta.inject.Inject;
1213
import org.slf4j.Logger;
1314
import org.slf4j.LoggerFactory;
1415

@@ -22,16 +23,8 @@
2223
public class ValidateController {
2324

2425
private static final Logger LOG = LoggerFactory.getLogger(ValidateController.class);
25-
private final FileDownloadService fileDownloadService;
26-
27-
/**
28-
* Constructor for ValidateController.
29-
*
30-
* @param fileDownloadService service for downloading files
31-
*/
32-
public ValidateController(FileDownloadService fileDownloadService) {
33-
this.fileDownloadService = fileDownloadService;
34-
}
26+
@Inject
27+
FileDownloadService fileDownloadService;
3528

3629
/**
3730
* Handles form URL encoded validation requests.

src/main/java/com/evolvedbinary/bblValidator/controller/VersionController.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,8 @@
1010
@Controller
1111
public class VersionController {
1212

13-
private final String version;
14-
15-
public VersionController(@Value("${api.version}") String version) {
16-
this.version = version;
17-
}
13+
@Value("${api.version}")
14+
String version;
1815

1916
@Get("/version")
2017
@Produces(MediaType.APPLICATION_JSON)

src/main/java/com/evolvedbinary/bblValidator/dto/ValidationResponse.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public String getSource() {
4848
return source;
4949
}
5050

51-
public void setSource(String url) {
51+
public void setSource(String source) {
5252
this.source = source;
5353
}
5454
}

src/main/java/com/evolvedbinary/bblValidator/service/SchemaService.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import java.util.Map;
2020
import java.util.stream.Stream;
2121

22+
// TODO talk to Adam about syncronaztion
2223
@Singleton
2324
public class SchemaService {
2425

@@ -53,6 +54,12 @@ public void loadSchemas() {
5354
}
5455

5556
private void loadSchemasFromClasspath() {
57+
// close the file input stream
58+
// try with resoucres
59+
// avoid class path
60+
// in application yaml add a property for schema folder
61+
// make it relative to the start up location
62+
// if it starts with a slash then resolve it as absolut path
5663
try {
5764
// Get resource URL and list files
5865
ClassLoader classLoader = getClass().getClassLoader();

src/main/resources/application.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ micronaut:
44
server:
55
port: 8080
66
api:
7-
version: 1.0.0
7+
version: ${project.version}

0 commit comments

Comments
 (0)