Код: Выделить всё
@Component
@ConfigurationProperties(prefix = "connection")
public class ConnectConfig {
private String useragent;
private String referrer;
}
Код: Выделить всё
public class MyUtils {
public static Document connect(String url) throws IOException {
return Jsoup.connect(url).userAgent("ConnectConfig.useragent").referrer("ConnectConfig.referrer").execute().parse();
}
}
Подробнее здесь: https://stackoverflow.com/questions/784 ... c-function