mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
Add Tld scanning exceptions to Tomcat startup
Addresses gh-263 to some extent.
This commit is contained in:
parent
91998d5942
commit
1f1820b161
@ -90,12 +90,8 @@
|
||||
</activation>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-webapp</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-jetty</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
|
@ -37,6 +37,7 @@ import org.apache.catalina.Valve;
|
||||
import org.apache.catalina.Wrapper;
|
||||
import org.apache.catalina.connector.Connector;
|
||||
import org.apache.catalina.loader.WebappLoader;
|
||||
import org.apache.catalina.startup.TldConfig;
|
||||
import org.apache.catalina.startup.Tomcat;
|
||||
import org.apache.catalina.startup.Tomcat.FixContextListener;
|
||||
import org.apache.coyote.AbstractProtocol;
|
||||
@ -89,6 +90,14 @@ public class TomcatEmbeddedServletContainerFactory extends
|
||||
|
||||
private String protocol = DEFAULT_PROTOCOL;
|
||||
|
||||
private static String DEFAULT_NO_TLD_JARS = "tomcat-*.jar,tools.jar,commons-beanutils*.jar,commons-codec*.jar,commons-collections*.jar,"
|
||||
+ "commons-dbcp*.jar,commons-digester*.jar,commons-fileupload*.jar,commons-httpclient*.jar,commons-io*.jar,commons-lang*.jar,"
|
||||
+ "commons-logging*.jar,commons-math*.jar,commons-pool*.jar,jstl-*.jar,geronimo-spec-jaxrpc*.jar,wsdl4j*.jar,ant-*.jar,"
|
||||
+ "aspectj*.jar,jmx.jar,h2*.jar,hibernate*.jar,httpclient*.jar,jmx-tools-*.jar,jta*.jar,log4j-*.jar,mail*.jar,slf4j*.jar,"
|
||||
+ "xercesImpl-*.jar,xmlParserAPIs-*.jar,xml-apis-*.jar,junit-*.jar,hamcrest*.jar,org.hamcrest*.jar";
|
||||
|
||||
private String noTldJars = DEFAULT_NO_TLD_JARS;
|
||||
|
||||
/**
|
||||
* Create a new {@link TomcatEmbeddedServletContainerFactory} instance.
|
||||
*/
|
||||
@ -137,6 +146,7 @@ public class TomcatEmbeddedServletContainerFactory extends
|
||||
protected void prepareContext(Host host, ServletContextInitializer[] initializers) {
|
||||
File docBase = getValidDocumentRoot();
|
||||
docBase = (docBase != null ? docBase : createTempDir("tomcat-docbase"));
|
||||
TldConfig.setNoTldJars(this.noTldJars);
|
||||
TomcatEmbeddedContext context = new TomcatEmbeddedContext();
|
||||
context.setName(getContextPath());
|
||||
context.setPath(getContextPath());
|
||||
@ -281,6 +291,16 @@ public class TomcatEmbeddedServletContainerFactory extends
|
||||
this.baseDirectory = baseDirectory;
|
||||
}
|
||||
|
||||
/**
|
||||
* A comma-separated list of jars to ignore for TLD scanning. See Tomcat's
|
||||
* catalina.properties for typical values. Defaults to a list drawn from that source.
|
||||
*
|
||||
* @param noTldJars the noTldJars to set
|
||||
*/
|
||||
public void setNoTldJars(String noTldJars) {
|
||||
this.noTldJars = noTldJars;
|
||||
}
|
||||
|
||||
/**
|
||||
* The Tomcat protocol to use when create the {@link Connector}.
|
||||
* @see Connector#Connector(String)
|
||||
|
Loading…
Reference in New Issue
Block a user