diff --git a/pom.xml b/pom.xml index 014e4016c5..a392c142d0 100644 --- a/pom.xml +++ b/pom.xml @@ -94,7 +94,6 @@ querydsl - reactor-core redis rest-assured rest-testing @@ -111,7 +110,6 @@ spring-autowire spring-batch spring-boot - spring-boot-servlet spring-cloud-data-flow spring-cloud spring-core diff --git a/spring-boot-servlet/.gitignore b/spring-boot-servlet/.gitignore deleted file mode 100644 index 60be5b80aa..0000000000 --- a/spring-boot-servlet/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -/target/ -.settings/ -.classpath -.project diff --git a/spring-boot-servlet/README.md b/spring-boot-servlet/README.md deleted file mode 100644 index 262a11fc36..0000000000 --- a/spring-boot-servlet/README.md +++ /dev/null @@ -1,2 +0,0 @@ -###Relevant Articles: -- [How to Register a Servlet in a Java Web Application](http://www.baeldung.com/how-to-register-a-servlet-in-a-java-web-application/) \ No newline at end of file diff --git a/spring-boot-servlet/pom.xml b/spring-boot-servlet/pom.xml deleted file mode 100644 index 3818e3468f..0000000000 --- a/spring-boot-servlet/pom.xml +++ /dev/null @@ -1,55 +0,0 @@ - - 4.0.0 - com.baeldung - spring-boot-servlet - 0.0.1-SNAPSHOT - war - spring-boot-servlet - - - org.springframework.boot - spring-boot-dependencies - 1.5.1.RELEASE - - - - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-tomcat - provided - - - - org.apache.tomcat.embed - tomcat-embed-core - ${tomcat.version} - - - org.apache.tomcat.embed - tomcat-embed-jasper - ${tomcat.version} - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - - UTF-8 - 1.8 - 8.5.11 - - - diff --git a/spring-boot-servlet/src/main/java/META-INF/MANIFEST.MF b/spring-boot-servlet/src/main/java/META-INF/MANIFEST.MF deleted file mode 100644 index 69ebae1751..0000000000 --- a/spring-boot-servlet/src/main/java/META-INF/MANIFEST.MF +++ /dev/null @@ -1,2 +0,0 @@ -Manifest-Version: 1.0 -Main-Class: com.baeldung.ApplicationMain diff --git a/spring-boot-servlet/src/main/resources/application.properties b/spring-boot-servlet/src/main/resources/application.properties deleted file mode 100644 index 4e9e2b4cf1..0000000000 --- a/spring-boot-servlet/src/main/resources/application.properties +++ /dev/null @@ -1,10 +0,0 @@ -#Server Configuration -#server.port=8080 -#server.context-path=/javabootdata -#Resource Handling -#spring.resources.static-locations=classpath:/WEB-INF/resources -#spring.mvc.view.prefix=/WEB-INF/ -#spring.mvc.view.suffix=.jsp -#spring.resources.cache-period=3600 -servlet.name=dispatcherExample -servlet.mapping=/dispatcherExampleURL \ No newline at end of file diff --git a/spring-boot/README.MD b/spring-boot/README.MD index d0a02c69fc..78ef3c843c 100644 --- a/spring-boot/README.MD +++ b/spring-boot/README.MD @@ -10,3 +10,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [The @ServletComponentScan Annotation in Spring Boot](http://www.baeldung.com/spring-servletcomponentscan) - [A Custom Data Binder in Spring MVC](http://www.baeldung.com/spring-mvc-custom-data-binder) - [Intro to Building an Application with Spring Boot](http://www.baeldung.com/intro-to-spring-boot) +- [How to Register a Servlet in a Java Web Application](http://www.baeldung.com/how-to-register-a-servlet-in-a-java-web-application/) diff --git a/spring-boot/pom.xml b/spring-boot/pom.xml index e77ab10aff..65b0f247f8 100644 --- a/spring-boot/pom.xml +++ b/spring-boot/pom.xml @@ -41,6 +41,24 @@ spring-boot-starter-security + + org.springframework.boot + spring-boot-starter-tomcat + provided + + + + org.apache.tomcat.embed + tomcat-embed-core + ${tomcat.version} + + + + org.apache.tomcat.embed + tomcat-embed-jasper + ${tomcat.version} + + io.dropwizard.metrics metrics-core diff --git a/spring-boot-servlet/src/main/java/com/baeldung/ApplicationMain.java b/spring-boot/src/main/java/com/baeldung/servlets/ApplicationMain.java similarity index 95% rename from spring-boot-servlet/src/main/java/com/baeldung/ApplicationMain.java rename to spring-boot/src/main/java/com/baeldung/servlets/ApplicationMain.java index 66f2e85999..a6ea3757fe 100644 --- a/spring-boot-servlet/src/main/java/com/baeldung/ApplicationMain.java +++ b/spring-boot/src/main/java/com/baeldung/servlets/ApplicationMain.java @@ -1,4 +1,4 @@ -package com.baeldung; +package com.baeldung.servlets; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -16,4 +16,4 @@ public class ApplicationMain extends SpringBootServletInitializer { protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(ApplicationMain.class); } -} \ No newline at end of file +} diff --git a/spring-boot-servlet/src/main/java/com/baeldung/configuration/WebAppInitializer.java b/spring-boot/src/main/java/com/baeldung/servlets/configuration/WebAppInitializer.java similarity index 96% rename from spring-boot-servlet/src/main/java/com/baeldung/configuration/WebAppInitializer.java rename to spring-boot/src/main/java/com/baeldung/servlets/configuration/WebAppInitializer.java index b7e22500f4..eadd40355a 100644 --- a/spring-boot-servlet/src/main/java/com/baeldung/configuration/WebAppInitializer.java +++ b/spring-boot/src/main/java/com/baeldung/servlets/configuration/WebAppInitializer.java @@ -1,4 +1,4 @@ -package com.baeldung.configuration; +package com.baeldung.servlets.configuration; import org.springframework.web.WebApplicationInitializer; import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; @@ -29,4 +29,4 @@ public class WebAppInitializer implements WebApplicationInitializer { servletTwo.addMapping("/"); } -} \ No newline at end of file +} diff --git a/spring-boot-servlet/src/main/java/com/baeldung/configuration/WebMvcConfigure.java b/spring-boot/src/main/java/com/baeldung/servlets/configuration/WebMvcConfigure.java similarity index 97% rename from spring-boot-servlet/src/main/java/com/baeldung/configuration/WebMvcConfigure.java rename to spring-boot/src/main/java/com/baeldung/servlets/configuration/WebMvcConfigure.java index de9067de6e..3d6a10c2ac 100644 --- a/spring-boot-servlet/src/main/java/com/baeldung/configuration/WebMvcConfigure.java +++ b/spring-boot/src/main/java/com/baeldung/servlets/configuration/WebMvcConfigure.java @@ -1,4 +1,4 @@ -package com.baeldung.configuration; +package com.baeldung.servlets.configuration; import org.springframework.boot.web.support.ErrorPageFilter; import org.springframework.context.annotation.Bean; @@ -37,4 +37,3 @@ public class WebMvcConfigure extends WebMvcConfigurerAdapter { return new ErrorPageFilter(); } } - diff --git a/spring-boot-servlet/src/main/java/com/baeldung/props/Constants.java b/spring-boot/src/main/java/com/baeldung/servlets/props/Constants.java similarity index 95% rename from spring-boot-servlet/src/main/java/com/baeldung/props/Constants.java rename to spring-boot/src/main/java/com/baeldung/servlets/props/Constants.java index 421401eec7..6345d1f969 100644 --- a/spring-boot-servlet/src/main/java/com/baeldung/props/Constants.java +++ b/spring-boot/src/main/java/com/baeldung/servlets/props/Constants.java @@ -1,4 +1,4 @@ -package com.baeldung.props; +package com.baeldung.servlets.props; import org.springframework.beans.factory.annotation.Autowired; diff --git a/spring-boot-servlet/src/main/java/com/baeldung/props/PropertyLoader.java b/spring-boot/src/main/java/com/baeldung/servlets/props/PropertyLoader.java similarity index 94% rename from spring-boot-servlet/src/main/java/com/baeldung/props/PropertyLoader.java rename to spring-boot/src/main/java/com/baeldung/servlets/props/PropertyLoader.java index 5d890d96fa..c29da45929 100644 --- a/spring-boot-servlet/src/main/java/com/baeldung/props/PropertyLoader.java +++ b/spring-boot/src/main/java/com/baeldung/servlets/props/PropertyLoader.java @@ -1,4 +1,4 @@ -package com.baeldung.props; +package com.baeldung.servlets.props; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/spring-boot-servlet/src/main/java/com/baeldung/props/PropertySourcesLoader.java b/spring-boot/src/main/java/com/baeldung/servlets/props/PropertySourcesLoader.java similarity index 95% rename from spring-boot-servlet/src/main/java/com/baeldung/props/PropertySourcesLoader.java rename to spring-boot/src/main/java/com/baeldung/servlets/props/PropertySourcesLoader.java index 8c7b3a4af5..56a6751326 100644 --- a/spring-boot-servlet/src/main/java/com/baeldung/props/PropertySourcesLoader.java +++ b/spring-boot/src/main/java/com/baeldung/servlets/props/PropertySourcesLoader.java @@ -1,4 +1,4 @@ -package com.baeldung.props; +package com.baeldung.servlets.props; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/spring-boot-servlet/src/main/java/com/baeldung/servlets/GenericCustomServlet.java b/spring-boot/src/main/java/com/baeldung/servlets/servlets/GenericCustomServlet.java similarity index 93% rename from spring-boot-servlet/src/main/java/com/baeldung/servlets/GenericCustomServlet.java rename to spring-boot/src/main/java/com/baeldung/servlets/servlets/GenericCustomServlet.java index c6543c9eef..49dd9404b7 100644 --- a/spring-boot-servlet/src/main/java/com/baeldung/servlets/GenericCustomServlet.java +++ b/spring-boot/src/main/java/com/baeldung/servlets/servlets/GenericCustomServlet.java @@ -1,4 +1,4 @@ -package com.baeldung.servlets; +package com.baeldung.servlets.servlets; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; diff --git a/spring-boot-servlet/src/main/java/com/baeldung/servlets/javaee/AnnotationServlet.java b/spring-boot/src/main/java/com/baeldung/servlets/servlets/javaee/AnnotationServlet.java similarity index 93% rename from spring-boot-servlet/src/main/java/com/baeldung/servlets/javaee/AnnotationServlet.java rename to spring-boot/src/main/java/com/baeldung/servlets/servlets/javaee/AnnotationServlet.java index d971e68cfa..b50a7d5454 100644 --- a/spring-boot-servlet/src/main/java/com/baeldung/servlets/javaee/AnnotationServlet.java +++ b/spring-boot/src/main/java/com/baeldung/servlets/servlets/javaee/AnnotationServlet.java @@ -1,4 +1,4 @@ -package com.baeldung.servlets.javaee; +package com.baeldung.servlets.servlets.javaee; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; diff --git a/spring-boot-servlet/src/main/java/com/baeldung/servlets/javaee/EEWebXmlServlet.java b/spring-boot/src/main/java/com/baeldung/servlets/servlets/javaee/EEWebXmlServlet.java similarity index 92% rename from spring-boot-servlet/src/main/java/com/baeldung/servlets/javaee/EEWebXmlServlet.java rename to spring-boot/src/main/java/com/baeldung/servlets/servlets/javaee/EEWebXmlServlet.java index 4209e815cd..c7b373064f 100644 --- a/spring-boot-servlet/src/main/java/com/baeldung/servlets/javaee/EEWebXmlServlet.java +++ b/spring-boot/src/main/java/com/baeldung/servlets/servlets/javaee/EEWebXmlServlet.java @@ -1,4 +1,4 @@ -package com.baeldung.servlets.javaee; +package com.baeldung.servlets.servlets.javaee; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; @@ -17,4 +17,4 @@ public class EEWebXmlServlet extends HttpServlet { PrintWriter out = response.getWriter(); out.println("

Hello World

"); } -} \ No newline at end of file +} diff --git a/spring-boot-servlet/src/main/java/com/baeldung/servlets/springboot/SpringRegistrationBeanServlet.java b/spring-boot/src/main/java/com/baeldung/servlets/servlets/springboot/SpringRegistrationBeanServlet.java similarity index 82% rename from spring-boot-servlet/src/main/java/com/baeldung/servlets/springboot/SpringRegistrationBeanServlet.java rename to spring-boot/src/main/java/com/baeldung/servlets/servlets/springboot/SpringRegistrationBeanServlet.java index 4a34465894..e3c225d429 100644 --- a/spring-boot-servlet/src/main/java/com/baeldung/servlets/springboot/SpringRegistrationBeanServlet.java +++ b/spring-boot/src/main/java/com/baeldung/servlets/servlets/springboot/SpringRegistrationBeanServlet.java @@ -1,6 +1,6 @@ -package com.baeldung.servlets.springboot; +package com.baeldung.servlets.servlets.springboot; -import com.baeldung.servlets.GenericCustomServlet; +import com.baeldung.servlets.servlets.GenericCustomServlet; import org.springframework.boot.web.servlet.ServletRegistrationBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -15,5 +15,3 @@ public class SpringRegistrationBeanServlet { return bean; } } - - diff --git a/spring-boot-servlet/src/main/java/com/baeldung/servlets/springboot/embedded/EmbeddedTomcatExample.java b/spring-boot/src/main/java/com/baeldung/servlets/servlets/springboot/embedded/EmbeddedTomcatExample.java similarity index 90% rename from spring-boot-servlet/src/main/java/com/baeldung/servlets/springboot/embedded/EmbeddedTomcatExample.java rename to spring-boot/src/main/java/com/baeldung/servlets/servlets/springboot/embedded/EmbeddedTomcatExample.java index b2458f33c7..9e460d03a8 100644 --- a/spring-boot-servlet/src/main/java/com/baeldung/servlets/springboot/embedded/EmbeddedTomcatExample.java +++ b/spring-boot/src/main/java/com/baeldung/servlets/servlets/springboot/embedded/EmbeddedTomcatExample.java @@ -1,4 +1,4 @@ -package com.baeldung.servlets.springboot.embedded; +package com.baeldung.servlets.servlets.springboot.embedded; import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory; import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; diff --git a/spring-boot/src/main/resources/application.properties b/spring-boot/src/main/resources/application.properties index d30045d1dc..8c6549f53d 100644 --- a/spring-boot/src/main/resources/application.properties +++ b/spring-boot/src/main/resources/application.properties @@ -28,4 +28,8 @@ security.user.name=admin1 security.user.password=secret1 management.security.role=SUPERUSER -logging.level.org.springframework=INFO \ No newline at end of file +logging.level.org.springframework=INFO + +#Servlet Configuration +servlet.name=dispatcherExample +servlet.mapping=/dispatcherExampleURL diff --git a/spring-boot-servlet/src/main/resources/custom.properties b/spring-boot/src/main/resources/custom.properties similarity index 100% rename from spring-boot-servlet/src/main/resources/custom.properties rename to spring-boot/src/main/resources/custom.properties diff --git a/spring-boot-servlet/src/main/webapp/WEB-INF/context.xml b/spring-boot/src/main/webapp/WEB-INF/context.xml similarity index 100% rename from spring-boot-servlet/src/main/webapp/WEB-INF/context.xml rename to spring-boot/src/main/webapp/WEB-INF/context.xml diff --git a/spring-boot-servlet/src/main/webapp/WEB-INF/dispatcher.xml b/spring-boot/src/main/webapp/WEB-INF/dispatcher.xml similarity index 100% rename from spring-boot-servlet/src/main/webapp/WEB-INF/dispatcher.xml rename to spring-boot/src/main/webapp/WEB-INF/dispatcher.xml diff --git a/spring-boot-servlet/src/main/webapp/WEB-INF/web.xml b/spring-boot/src/main/webapp/WEB-INF/web.xml similarity index 100% rename from spring-boot-servlet/src/main/webapp/WEB-INF/web.xml rename to spring-boot/src/main/webapp/WEB-INF/web.xml diff --git a/spring-boot-servlet/src/main/webapp/annotationservlet.jsp b/spring-boot/src/main/webapp/annotationservlet.jsp similarity index 100% rename from spring-boot-servlet/src/main/webapp/annotationservlet.jsp rename to spring-boot/src/main/webapp/annotationservlet.jsp diff --git a/spring-boot-servlet/src/main/webapp/index.jsp b/spring-boot/src/main/webapp/index.jsp similarity index 100% rename from spring-boot-servlet/src/main/webapp/index.jsp rename to spring-boot/src/main/webapp/index.jsp