java - Is possible to get web application full url from Spring service that is invoked by task? -
i have service not invoked user request, task. need send email task, , email contains link web application, how can full url of application email can link web application?
example of service:
@service public class myservice { @scheduled(cron="0 */10 * * * *") @transactional public void mytask() throws ioexception, parseexception { // have send email app url, how can here ? } }
you cannot it, since web application doesn't know own domain name. can extract domain name used send request request.
therefore domain name of application should part of configuration, , task should obtain there.
Comments
Post a Comment