Replace Spring's removed @Required annotation with our own

Spring 6 removed @Required and they suggest using constructor injection instead. If we switched our beans to that we'd break existing Heritrix crawl configs. So this change implements our own basic version so we still get errors when a @Required property is null.
This commit is contained in:
Alex Osborne
2024-11-20 16:30:15 +09:00
parent 055f4f9f22
commit dd210c8e70
12 changed files with 76 additions and 11 deletions
@@ -29,10 +29,10 @@ import javax.script.ScriptException;
import org.apache.commons.io.IOUtils;
import org.archive.io.ReadSource;
import org.archive.spring.Required;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanInitializationException;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Required;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
@@ -30,10 +30,10 @@ import javax.script.ScriptException;
import org.apache.commons.io.IOUtils;
import org.archive.io.ReadSource;
import org.archive.modules.CrawlURI;
import org.archive.spring.Required;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanInitializationException;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Required;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
@@ -23,8 +23,8 @@ import java.util.ArrayList;
import java.util.List;
import org.archive.modules.CrawlURI;
import org.archive.spring.Required;
import org.archive.util.SurtPrefixSet;
import org.springframework.beans.factory.annotation.Required;
/**
* Rule applies the configured decision for any URI which has a 'via' whose
@@ -36,12 +36,12 @@ import org.archive.modules.CrawlURI;
import org.archive.modules.SchedulingConstants;
import org.archive.net.UURI;
import org.archive.net.UURIFactory;
import org.archive.spring.Required;
import org.archive.spring.WriteTarget;
import org.archive.util.ArchiveUtils;
import org.archive.util.DevUtils;
import org.archive.util.iterator.LineReadingIterator;
import org.archive.util.iterator.RegexLineIterator;
import org.springframework.beans.factory.annotation.Required;
/**
* Module that announces a list of seeds from a text source (such