Skip to content

Commit

Permalink
Merge pull request #128 from donbourne/move_resources
Browse files Browse the repository at this point in the history
move resource file
  • Loading branch information
mbroz2 authored Oct 4, 2024
2 parents 968a8af + afb69e7 commit 56b86ab
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 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 @@ -19,13 +19,14 @@
import java.io.StringReader;

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 +84,8 @@ public Map<String, String> getProperties() {
public String readFile(String fileName) {
String result = "";
try {
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 56b86ab

Please sign in to comment.