/
spirzen
/
it-code-examples
Обзор
Документация
Войти
/
spirzen
/
it-code-examples
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
examples/java/java-503-101-034/main.java
25 строк
897 B
Spirzen
Code migration pack
09 июн 2026, 01:41
09 июн 2026, 01:41
cebc284
Код
Авторство
О чём код?
public class ResourceLoader { public String loadTemplate(String templateName) throws IOException { URL resourceUrl = getClass().getClassLoader() .getResource("templates/" + templateName + ".html"); if (resourceUrl == null) { throw new FileNotFoundException("Template not found: " + templateName); } return Files.readString(Path.of(resourceUrl.toURI())); } public Properties loadConfiguration() throws IOException { Properties properties = new Properties(); try (InputStream input = getClass().getClassLoader() .getResourceAsStream("application.properties")) { if (input == null) { throw new FileNotFoundException("Configuration file not found"); } properties.load(input); } return properties; } }