Skip to content

Commit

Permalink
move resource file
Browse files Browse the repository at this point in the history
  • Loading branch information
donbourne committed Oct 3, 2024
1 parent 968a8af commit 8450521
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ LABEL \
description="This image contains a sample application that displays the Java system properties and demonstrates MicroProfile Config, Health and Metrics."

COPY --chown=1001:0 src/main/liberty/config/ /config/
COPY --chown=1001:0 resources/ /output/resources/

RUN features.sh

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.InputStream;
import java.io.InputStreamReader;

import org.eclipse.microprofile.config.spi.ConfigSource;

public class CustomConfigSource implements ConfigSource {

String fileLocation = System.getProperty("user.dir").split("target")[0]
+ "/resources/CustomConfigSource.json";
String fileLocation = "META-INF/CustomConfigSource.json";

@Override
public int getOrdinal() {
Expand Down Expand Up @@ -83,7 +85,9 @@ public Map<String, String> getProperties() {
public String readFile(String fileName) {
String result = "";
try {
BufferedReader br = new BufferedReader(new FileReader(fileName));
// BufferedReader br = new BufferedReader(new FileReader(fileName));
InputStream is = this.getClass().getClassLoader().getResourceAsStream(fileName);
BufferedReader br = new BufferedReader(new InputStreamReader(is, "UTF-8"));
StringBuilder sb = new StringBuilder();
String line = br.readLine();
while (line != null) {
Expand Down
File renamed without changes.

0 comments on commit 8450521

Please sign in to comment.