diff --git a/spring-boot/pom.xml b/spring-boot/pom.xml
index b6a24b6cb7..e77ab10aff 100644
--- a/spring-boot/pom.xml
+++ b/spring-boot/pom.xml
@@ -24,26 +24,6 @@
org.springframework.boot
spring-boot-starter-web
-
-
- org.springframework.boot
- spring-boot-starter-tomcat
-
-
-
-
-
- org.apache.geronimo.specs
- geronimo-osgi-locator
- 1.1
- test
-
-
-
- org.apache.geronimo.components
- geronimo-jaspi
- 2.0.0
- test
@@ -109,18 +89,12 @@
- org.apache.tomee
- arquillian-tomee-embedded
- ${arquillian-tomee-embedded.version}
- test
-
-
-
- org.apache.tomee
- javaee-api
- ${tomee-javaee-api.version}
+ org.apache.tomcat
+ tomcat-servlet-api
+ ${tomee-servlet-api.version}
provided
+
@@ -220,8 +194,7 @@
3.1.1
3.3.7-1
3.1.7
- 7.0.2
- 7.0-1
+ 8.5.11
diff --git a/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/JavaEEApp.java b/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/JavaEEApp.java
deleted file mode 100644
index 773503c5af..0000000000
--- a/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/JavaEEApp.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.baeldung.annotation.servletcomponentscan;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.context.Initialized;
-import javax.enterprise.event.Observes;
-import javax.servlet.ServletContext;
-
-@ApplicationScoped
-public class JavaEEApp {
-
- private ServletContext context;
-
- /**
- * act as a servletContext provider
- */
- private void setContext(@Observes @Initialized(ApplicationScoped.class) final ServletContext context) {
- if (this.context != null) {
- throw new IllegalStateException("app context started twice");
- }
-
- this.context = context;
- }
-
- public ServletContext getContext() {
- return context;
- }
-
-}
diff --git a/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/SpringBootAnnotatedApp.java b/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/SpringBootAnnotatedApp.java
index 9fd66ee12a..b4d416dd96 100644
--- a/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/SpringBootAnnotatedApp.java
+++ b/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/SpringBootAnnotatedApp.java
@@ -9,13 +9,13 @@ import org.springframework.boot.web.servlet.ServletComponentScan;
* -
*
@ServletComponentScan
* -
- *
@ServletComponentScan(basePackages = "com.baeldung.annotation.servletcomponentscan.javaee")
+ * @ServletComponentScan(basePackages = "com.baeldung.annotation.servletcomponentscan.components")
* -
*
@ServletComponentScan(basePackageClasses = {AttrListener.class, HelloFilter.class, HelloServlet.class, EchoServlet.class})
*
*/
@SpringBootApplication
-@ServletComponentScan("com.baeldung.annotation.servletcomponentscan.javaee")
+@ServletComponentScan("com.baeldung.annotation.servletcomponentscan.components")
public class SpringBootAnnotatedApp {
public static void main(String[] args) {
diff --git a/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/SpringBootPlainApp.java b/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/SpringBootPlainApp.java
index 9ce1c296e6..8a39078aac 100644
--- a/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/SpringBootPlainApp.java
+++ b/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/SpringBootPlainApp.java
@@ -4,7 +4,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
@SpringBootApplication
-@ComponentScan(basePackages = "com.baeldung.annotation.servletcomponentscan.javaee")
+@ComponentScan(basePackages = "com.baeldung.annotation.servletcomponentscan.components")
public class SpringBootPlainApp {
public static void main(String[] args) {
diff --git a/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/javaee/AttrListener.java b/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/components/AttrListener.java
similarity index 90%
rename from spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/javaee/AttrListener.java
rename to spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/components/AttrListener.java
index 321ddd59d1..bad39c52c4 100644
--- a/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/javaee/AttrListener.java
+++ b/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/components/AttrListener.java
@@ -1,4 +1,4 @@
-package com.baeldung.annotation.servletcomponentscan.javaee;
+package com.baeldung.annotation.servletcomponentscan.components;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
diff --git a/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/javaee/EchoServlet.java b/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/components/EchoServlet.java
similarity index 90%
rename from spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/javaee/EchoServlet.java
rename to spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/components/EchoServlet.java
index b9fed314c7..3419cd0eaf 100644
--- a/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/javaee/EchoServlet.java
+++ b/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/components/EchoServlet.java
@@ -1,4 +1,4 @@
-package com.baeldung.annotation.servletcomponentscan.javaee;
+package com.baeldung.annotation.servletcomponentscan.components;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
@@ -6,7 +6,6 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
-import java.nio.file.CopyOption;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
diff --git a/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/javaee/HelloFilter.java b/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/components/HelloFilter.java
similarity index 94%
rename from spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/javaee/HelloFilter.java
rename to spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/components/HelloFilter.java
index 81e90d69ad..dc2368c5b2 100644
--- a/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/javaee/HelloFilter.java
+++ b/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/components/HelloFilter.java
@@ -1,4 +1,4 @@
-package com.baeldung.annotation.servletcomponentscan.javaee;
+package com.baeldung.annotation.servletcomponentscan.components;
import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
diff --git a/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/javaee/HelloServlet.java b/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/components/HelloServlet.java
similarity index 90%
rename from spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/javaee/HelloServlet.java
rename to spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/components/HelloServlet.java
index 4a46a56107..aeae7aecc9 100644
--- a/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/javaee/HelloServlet.java
+++ b/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/components/HelloServlet.java
@@ -1,7 +1,6 @@
-package com.baeldung.annotation.servletcomponentscan.javaee;
+package com.baeldung.annotation.servletcomponentscan.components;
import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
import javax.servlet.annotation.WebInitParam;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
diff --git a/spring-boot/src/test/java/com/baeldung/annotation/servletcomponentscan/JavaEEAppIntegrationTest.java b/spring-boot/src/test/java/com/baeldung/annotation/servletcomponentscan/JavaEEAppIntegrationTest.java
deleted file mode 100644
index 95106d2dc8..0000000000
--- a/spring-boot/src/test/java/com/baeldung/annotation/servletcomponentscan/JavaEEAppIntegrationTest.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package com.baeldung.annotation.servletcomponentscan;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URL;
-
-import javax.inject.Inject;
-import javax.servlet.FilterRegistration;
-import javax.servlet.ServletContext;
-import javax.ws.rs.client.Client;
-import javax.ws.rs.client.ClientBuilder;
-import javax.ws.rs.client.Entity;
-import javax.ws.rs.client.WebTarget;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import org.jboss.arquillian.container.test.api.Deployment;
-import org.jboss.arquillian.container.test.api.RunAsClient;
-import org.jboss.arquillian.junit.Arquillian;
-import org.jboss.arquillian.test.api.ArquillianResource;
-import org.jboss.shrinkwrap.api.ShrinkWrap;
-import org.jboss.shrinkwrap.api.spec.WebArchive;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import com.baeldung.annotation.servletcomponentscan.javaee.AttrListener;
-import com.baeldung.annotation.servletcomponentscan.javaee.EchoServlet;
-import com.baeldung.annotation.servletcomponentscan.javaee.HelloFilter;
-import com.baeldung.annotation.servletcomponentscan.javaee.HelloServlet;
-
-@RunWith(Arquillian.class)
-public class JavaEEAppIntegrationTest {
-
- @Deployment
- public static WebArchive createDeployment() {
- return ShrinkWrap.create(WebArchive.class).addClass(JavaEEApp.class).addClasses(AttrListener.class, HelloFilter.class, HelloServlet.class, EchoServlet.class);
- }
-
- @Inject
- private ServletContext servletContext;
-
- @Test
- public void givenServletContextListener_whenAccessSpecialAttrs_thenFound() throws MalformedURLException {
- assertNotNull(servletContext);
- assertNotNull(servletContext.getAttribute("servlet-context-attr"));
- assertEquals("test", servletContext.getAttribute("servlet-context-attr"));
- }
-
- @Test
- public void givenServletContext_whenCheckHelloFilterMappings_thenCorrect() throws MalformedURLException {
- assertNotNull(servletContext);
- FilterRegistration filterRegistration = servletContext.getFilterRegistration("hello filter");
-
- assertNotNull(filterRegistration);
- assertTrue(filterRegistration.getServletNameMappings().contains("echo servlet"));
- }
-
- @ArquillianResource
- private URL base;
-
- @Test
- @RunAsClient
- public void givenFilterAndServlet_whenGetHello_thenRespondFilteringHello() throws MalformedURLException {
- Client client = ClientBuilder.newClient();
- WebTarget target = client.target(URI.create(new URL(base, "hello").toExternalForm()));
- Response response = target.request().get();
-
- assertEquals("filtering hello", response.readEntity(String.class));
- }
-
- @Test
- @RunAsClient
- public void givenFilterAndServlet_whenPostEcho_thenEchoFiltered() throws MalformedURLException {
- Client client = ClientBuilder.newClient();
- WebTarget target = client.target(URI.create(new URL(base, "echo").toExternalForm()));
- Response response = target.request().post(Entity.entity("echo", MediaType.TEXT_PLAIN_TYPE));
-
- assertEquals("filtering echo", response.readEntity(String.class));
- }
-
-}
diff --git a/spring-boot/src/test/java/com/baeldung/annotation/servletcomponentscan/SpringBootWithServletComponentIntegrationTest.java b/spring-boot/src/test/java/com/baeldung/annotation/servletcomponentscan/SpringBootWithServletComponentIntegrationTest.java
index 81ac3c9841..8d5eb56bf4 100644
--- a/spring-boot/src/test/java/com/baeldung/annotation/servletcomponentscan/SpringBootWithServletComponentIntegrationTest.java
+++ b/spring-boot/src/test/java/com/baeldung/annotation/servletcomponentscan/SpringBootWithServletComponentIntegrationTest.java
@@ -19,7 +19,7 @@ import static org.junit.Assert.*;
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = SpringBootAnnotatedApp.class)
@AutoConfigureMockMvc
-@TestPropertySource(properties = { "security.basic.enabled=false", "server.tomcat.additional-tld-skip-patterns=tomee-*.jar,tomcat-*.jar,openejb-*.jar,cxf-*.jar,activemq-*.jar" })
+@TestPropertySource(properties = { "security.basic.enabled=false" })
public class SpringBootWithServletComponentIntegrationTest {
@Autowired private ServletContext servletContext;
diff --git a/spring-boot/src/test/java/com/baeldung/annotation/servletcomponentscan/SpringBootWithoutServletComponentIntegrationTest.java b/spring-boot/src/test/java/com/baeldung/annotation/servletcomponentscan/SpringBootWithoutServletComponentIntegrationTest.java
index b2dea25864..64507ad02c 100644
--- a/spring-boot/src/test/java/com/baeldung/annotation/servletcomponentscan/SpringBootWithoutServletComponentIntegrationTest.java
+++ b/spring-boot/src/test/java/com/baeldung/annotation/servletcomponentscan/SpringBootWithoutServletComponentIntegrationTest.java
@@ -19,7 +19,7 @@ import static org.junit.Assert.*;
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = SpringBootPlainApp.class)
@AutoConfigureMockMvc
-@TestPropertySource(properties = { "security.basic.enabled=false", "server.tomcat.additional-tld-skip-patterns=tomee-*.jar,tomcat-*.jar,openejb-*.jar,cxf-*.jar,activemq-*.jar" })
+@TestPropertySource(properties = { "security.basic.enabled=false" })
public class SpringBootWithoutServletComponentIntegrationTest {
@Autowired private ServletContext servletContext;