4.0.0
- SpringCloudTaskSink
- SpringCloudTaskSink
+ springcloudtasksink
+ springcloudtasksink
jar
Demo project for Spring Boot
diff --git a/spring-core-2/src/main/java/com/baeldung/spring/config/MainWebAppInitializer.java b/spring-core-2/src/main/java/com/baeldung/spring/config/MyWebApplicationInitializer.java
similarity index 81%
rename from spring-core-2/src/main/java/com/baeldung/spring/config/MainWebAppInitializer.java
rename to spring-core-2/src/main/java/com/baeldung/spring/config/MyWebApplicationInitializer.java
index dd396a653f..034386ade9 100644
--- a/spring-core-2/src/main/java/com/baeldung/spring/config/MainWebAppInitializer.java
+++ b/spring-core-2/src/main/java/com/baeldung/spring/config/MyWebApplicationInitializer.java
@@ -6,15 +6,12 @@ import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletRegistration;
-import org.springframework.context.support.GenericApplicationContext;
import org.springframework.web.WebApplicationInitializer;
import org.springframework.web.context.ContextLoaderListener;
-import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
-import org.springframework.web.context.support.GenericWebApplicationContext;
import org.springframework.web.servlet.DispatcherServlet;
-public class MainWebAppInitializer implements WebApplicationInitializer
+public class MyWebApplicationInitializer implements WebApplicationInitializer
{
/**
@@ -22,7 +19,7 @@ public class MainWebAppInitializer implements WebApplicationInitializer
*/
@Override
public void onStartup(final ServletContext sc) throws ServletException {
- System.out.println("MainWebAppInitializer.onStartup()");
+ System.out.println("MyWebApplicationInitializer.onStartup()");
// Create the 'root' Spring application context
final AnnotationConfigWebApplicationContext root = new AnnotationConfigWebApplicationContext();
diff --git a/spring-core-2/src/test/java/com/baeldung/profiles/SpringProfilesWithMavenPropertiesIntegrationTest.java b/spring-core-2/src/test/java/com/baeldung/profiles/SpringProfilesWithMavenPropertiesIntegrationTest.java
index 60e9499d4b..1380e34ebd 100644
--- a/spring-core-2/src/test/java/com/baeldung/profiles/SpringProfilesWithMavenPropertiesIntegrationTest.java
+++ b/spring-core-2/src/test/java/com/baeldung/profiles/SpringProfilesWithMavenPropertiesIntegrationTest.java
@@ -16,7 +16,7 @@ public class SpringProfilesWithMavenPropertiesIntegrationTest {
DatasourceConfig datasourceConfig;
@Test
- public void testSpringProfiles() {
+ public void setupDatasource() {
Assert.assertTrue(datasourceConfig instanceof DevDatasourceConfig);
}
}
\ No newline at end of file
diff --git a/spring-mvc-crash/.gitignore b/spring-mvc-crash/.gitignore
new file mode 100644
index 0000000000..83c05e60c8
--- /dev/null
+++ b/spring-mvc-crash/.gitignore
@@ -0,0 +1,13 @@
+*.class
+
+#folders#
+/target
+/neoDb*
+/data
+/src/main/webapp/WEB-INF/classes
+*/META-INF/*
+
+# Packaged files #
+*.jar
+*.war
+*.ear
\ No newline at end of file
diff --git a/spring-mvc-crash/README.md b/spring-mvc-crash/README.md
new file mode 100644
index 0000000000..f158a947b6
--- /dev/null
+++ b/spring-mvc-crash/README.md
@@ -0,0 +1,11 @@
+## Spring MVC XML
+
+This module contains articles about Spring MVC with XML configuration
+
+### Relevant Articles:
+
+- [Getting Started with CRaSH](https://www.baeldung.com/jvm-crash-shell)
+
+## Spring MVC with XML Configuration Example Project
+
+- access a sample jsp page at: `http://localhost:8080/spring-mvc-crash/welcome.htm
\ No newline at end of file
diff --git a/spring-mvc-crash/pom.xml b/spring-mvc-crash/pom.xml
new file mode 100644
index 0000000000..d23e18361b
--- /dev/null
+++ b/spring-mvc-crash/pom.xml
@@ -0,0 +1,176 @@
+
+
+ 4.0.0
+ spring-mvc-crash
+ 0.1-SNAPSHOT
+ spring-mvc-xml
+ war
+
+
+ com.baeldung
+ parent-modules
+ 1.0.0-SNAPSHOT
+
+
+
+
+
+
+
+ org.springframework
+ spring-web
+ ${org.springframework.version}
+
+
+ org.springframework
+ spring-webmvc
+ ${org.springframework.version}
+
+
+
+
+
+ javax.servlet
+ javax.servlet-api
+ ${javax.servlet-api.version}
+ provided
+
+
+
+ javax.servlet
+ jstl
+ ${jstl.version}
+ runtime
+
+
+
+ org.hibernate.validator
+ hibernate-validator
+ ${hibernate-validator.version}
+
+
+
+
+
+ com.fasterxml.jackson.core
+ jackson-databind
+ ${jackson.version}
+
+
+
+
+ commons-io
+ commons-io
+ ${commons-io.version}
+
+
+ com.maxmind.geoip2
+ geoip2
+ ${geoip2.version}
+
+
+ com.fasterxml.jackson.core
+ jackson-databind
+
+
+ commons-logging
+ commons-logging
+
+
+
+
+ org.glassfish
+ javax.el
+ ${javax.el.version}
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ ${spring-boot.version}
+ test
+
+
+
+
+ org.crashub
+ crash.embed.spring
+ ${crash.version}
+
+
+ org.crashub
+ crash.cli
+ ${crash.version}
+
+
+ org.crashub
+ crash.connectors.telnet
+ ${crash.version}
+
+
+ log4j
+ log4j
+
+
+
+
+
+
+ org.codehaus.groovy
+ groovy
+ ${groovy.version}
+
+
+
+
+ spring-mvc-xml
+
+
+ src/main/resources
+ true
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-war-plugin
+ ${maven-war-plugin.version}
+
+
+
+
+
+
+
+
+ 5.0.2.RELEASE
+ 1.5.10.RELEASE
+
+
+ 5.1.40
+
+
+ 4.4.5
+ 4.5.2
+
+
+ 6.0.10.Final
+ 3.0.1-b08
+
+
+ 19.0
+ 2.8.0
+
+
+ 1.6.1
+
+ 1.3.2
+ 3.0.0-rc-3
+
+
+
+
diff --git a/spring-mvc-crash/src/main/java/com/baeldung/spring/ClientWebConfig.java b/spring-mvc-crash/src/main/java/com/baeldung/spring/ClientWebConfig.java
new file mode 100644
index 0000000000..cc60a1ff8f
--- /dev/null
+++ b/spring-mvc-crash/src/main/java/com/baeldung/spring/ClientWebConfig.java
@@ -0,0 +1,16 @@
+package com.baeldung.spring;
+
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.ImportResource;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+
+@ImportResource("classpath:webMvcConfig.xml")
+@Configuration
+@ComponentScan
+public class ClientWebConfig implements WebMvcConfigurer {
+
+ public ClientWebConfig() {
+ super();
+ }
+}
\ No newline at end of file
diff --git a/spring-mvc-crash/src/main/java/com/baeldung/spring/ClientWebConfigJava.java b/spring-mvc-crash/src/main/java/com/baeldung/spring/ClientWebConfigJava.java
new file mode 100644
index 0000000000..55af23034f
--- /dev/null
+++ b/spring-mvc-crash/src/main/java/com/baeldung/spring/ClientWebConfigJava.java
@@ -0,0 +1,33 @@
+package com.baeldung.spring;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.validation.beanvalidation.MethodValidationPostProcessor;
+import org.springframework.web.servlet.ViewResolver;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+import org.springframework.web.servlet.view.InternalResourceViewResolver;
+import org.springframework.web.servlet.view.JstlView;
+
+@ComponentScan("com.baeldung.spring")
+public class ClientWebConfigJava implements WebMvcConfigurer {
+
+ public ClientWebConfigJava() {
+ super();
+ }
+
+ @Bean
+ public ViewResolver viewResolver() {
+ final InternalResourceViewResolver bean = new InternalResourceViewResolver();
+
+ bean.setViewClass(JstlView.class);
+ bean.setPrefix("/WEB-INF/view/");
+ bean.setSuffix(".jsp");
+
+ return bean;
+ }
+
+ @Bean
+ public MethodValidationPostProcessor methodValidationPostProcessor() {
+ return new MethodValidationPostProcessor();
+ }
+}
\ No newline at end of file
diff --git a/spring-mvc-crash/src/main/java/com/baeldung/spring/controller/WelcomeController.java b/spring-mvc-crash/src/main/java/com/baeldung/spring/controller/WelcomeController.java
new file mode 100644
index 0000000000..526833611b
--- /dev/null
+++ b/spring-mvc-crash/src/main/java/com/baeldung/spring/controller/WelcomeController.java
@@ -0,0 +1,18 @@
+package com.baeldung.spring.controller;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.springframework.web.servlet.ModelAndView;
+import org.springframework.web.servlet.mvc.AbstractController;
+
+public class WelcomeController extends AbstractController {
+ @Override
+ protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
+
+ ModelAndView model = new ModelAndView("welcome");
+ model.addObject("msg", "Welcome to Introduction to CRaSH article from Baeldung");
+
+ return model;
+ }
+}
\ No newline at end of file
diff --git a/spring-mvc-crash/src/main/resources/contentManagementWebMvcConfig.xml b/spring-mvc-crash/src/main/resources/contentManagementWebMvcConfig.xml
new file mode 100644
index 0000000000..8a0671ca87
--- /dev/null
+++ b/spring-mvc-crash/src/main/resources/contentManagementWebMvcConfig.xml
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/spring-mvc-crash/src/main/resources/logback.xml b/spring-mvc-crash/src/main/resources/logback.xml
new file mode 100644
index 0000000000..56af2d397e
--- /dev/null
+++ b/spring-mvc-crash/src/main/resources/logback.xml
@@ -0,0 +1,19 @@
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-mvc-crash/src/main/resources/messages.properties b/spring-mvc-crash/src/main/resources/messages.properties
new file mode 100644
index 0000000000..2a3cccf76c
--- /dev/null
+++ b/spring-mvc-crash/src/main/resources/messages.properties
@@ -0,0 +1,2 @@
+required.name = Name is required!
+NotEmpty.person.password = Password is required!
\ No newline at end of file
diff --git a/spring-mvc-crash/src/main/resources/webMvcConfig.xml b/spring-mvc-crash/src/main/resources/webMvcConfig.xml
new file mode 100644
index 0000000000..4bdb405237
--- /dev/null
+++ b/spring-mvc-crash/src/main/resources/webMvcConfig.xml
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+ image/jpeg
+ image/png
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/spring-mvc-crash/src/main/webapp/WEB-INF/crash/commands/message.groovy b/spring-mvc-crash/src/main/webapp/WEB-INF/crash/commands/message.groovy
new file mode 100644
index 0000000000..d66ab13d96
--- /dev/null
+++ b/spring-mvc-crash/src/main/webapp/WEB-INF/crash/commands/message.groovy
@@ -0,0 +1,14 @@
+import org.crsh.cli.Command;
+import org.crsh.cli.Usage;
+import org.crsh.cli.Option;
+
+class message {
+
+ @Usage("show my own message")
+ @Command
+ Object main(@Usage("custom message") @Option(names=["m","message"]) String message) {
+ if (message == null)
+ message = "No message given...";
+ return message;
+ }
+}
\ No newline at end of file
diff --git a/spring-mvc-crash/src/main/webapp/WEB-INF/crash/commands/message2.java b/spring-mvc-crash/src/main/webapp/WEB-INF/crash/commands/message2.java
new file mode 100644
index 0000000000..d1ead88024
--- /dev/null
+++ b/spring-mvc-crash/src/main/webapp/WEB-INF/crash/commands/message2.java
@@ -0,0 +1,14 @@
+import org.crsh.command.BaseCommand;
+import org.crsh.cli.Usage;
+import org.crsh.cli.Command;
+import org.crsh.cli.Option;
+
+public class message2 extends BaseCommand {
+ @Usage("show my own message using java")
+ @Command
+ public Object main(@Usage("custom message") @Option(names = { "m", "message" }) String message) {
+ if (message == null)
+ message = "No message given...";
+ return message;
+ }
+}
\ No newline at end of file
diff --git a/spring-mvc-crash/src/main/webapp/WEB-INF/crash/crash.properties b/spring-mvc-crash/src/main/webapp/WEB-INF/crash/crash.properties
new file mode 100644
index 0000000000..f9ad0d7cf6
--- /dev/null
+++ b/spring-mvc-crash/src/main/webapp/WEB-INF/crash/crash.properties
@@ -0,0 +1 @@
+crash.telnet.port=50001
diff --git a/spring-mvc-crash/src/main/webapp/WEB-INF/crash/telnet.properties b/spring-mvc-crash/src/main/webapp/WEB-INF/crash/telnet.properties
new file mode 100644
index 0000000000..99071d09ff
--- /dev/null
+++ b/spring-mvc-crash/src/main/webapp/WEB-INF/crash/telnet.properties
@@ -0,0 +1,65 @@
+############################
+# Telnet daemon properties #
+############################
+
+#####################
+# Terminals Section #
+#####################
+
+# List of terminals available and defined below
+terminals=vt100,ansi,windoof,xterm
+
+# vt100 implementation and aliases
+term.vt100.class=net.wimpi.telnetd.io.terminal.vt100
+term.vt100.aliases=default,vt100-am,vt102,dec-vt100
+
+# ansi implementation and aliases
+term.ansi.class=net.wimpi.telnetd.io.terminal.ansi
+term.ansi.aliases=color-xterm,xterm-color,vt320,vt220,linux,screen
+
+# windoof implementation and aliases
+term.windoof.class=net.wimpi.telnetd.io.terminal.Windoof
+term.windoof.aliases=
+
+# xterm implementation and aliases
+term.xterm.class=net.wimpi.telnetd.io.terminal.xterm
+term.xterm.aliases=
+
+##################
+# Shells Section #
+##################
+
+# List of shells available and defined below
+shells=simple
+
+# shell implementations
+shell.simple.class=org.crsh.telnet.term.TelnetHandler
+
+#####################
+# Listeners Section #
+#####################
+listeners=std
+
+
+# std listener specific properties
+
+#Basic listener and connection management settings (port is commented because CRaSH configures it)
+# std.port=5000
+std.floodprotection=5
+std.maxcon=25
+
+
+# Timeout Settings for connections (ms)
+std.time_to_warning=3600000
+std.time_to_timedout=60000
+
+# Housekeeping thread active every 1 secs
+std.housekeepinginterval=1000
+
+std.inputmode=character
+
+# Login shell
+std.loginshell=simple
+
+# Connection filter class
+std.connectionfilter=none
\ No newline at end of file
diff --git a/spring-mvc-crash/src/main/webapp/WEB-INF/mvc-servlet.xml b/spring-mvc-crash/src/main/webapp/WEB-INF/mvc-servlet.xml
new file mode 100644
index 0000000000..46b159d984
--- /dev/null
+++ b/spring-mvc-crash/src/main/webapp/WEB-INF/mvc-servlet.xml
@@ -0,0 +1,52 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ welcomeController
+ welcomeController
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 5000
+
+
+
+
diff --git a/spring-mvc-crash/src/main/webapp/WEB-INF/view/error.jsp b/spring-mvc-crash/src/main/webapp/WEB-INF/view/error.jsp
new file mode 100644
index 0000000000..8f3d83af17
--- /dev/null
+++ b/spring-mvc-crash/src/main/webapp/WEB-INF/view/error.jsp
@@ -0,0 +1,20 @@
+<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
+ pageEncoding="ISO-8859-1"%>
+
+
+
+
+SpringMVCExample
+
+
+
+ Pleas enter the correct details
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-mvc-crash/src/main/webapp/WEB-INF/view/errorPage.jsp b/spring-mvc-crash/src/main/webapp/WEB-INF/view/errorPage.jsp
new file mode 100644
index 0000000000..ba8a836285
--- /dev/null
+++ b/spring-mvc-crash/src/main/webapp/WEB-INF/view/errorPage.jsp
@@ -0,0 +1,10 @@
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
+<%@ page session="false"%>
+
+
+ Home
+
+
+ ${errorMsg}
+
+
diff --git a/spring-mvc-crash/src/main/webapp/WEB-INF/view/welcome.jsp b/spring-mvc-crash/src/main/webapp/WEB-INF/view/welcome.jsp
new file mode 100644
index 0000000000..348ca652ff
--- /dev/null
+++ b/spring-mvc-crash/src/main/webapp/WEB-INF/view/welcome.jsp
@@ -0,0 +1,15 @@
+<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
+ pageEncoding="ISO-8859-1"%>
+
+
+
+
+Welcome Page
+
+
+ Welcome to ${msg}
+
+
+ Go to spring handler mappings homepage
+
+
\ No newline at end of file
diff --git a/spring-mvc-crash/src/main/webapp/WEB-INF/web.xml b/spring-mvc-crash/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000000..4a3d6cb321
--- /dev/null
+++ b/spring-mvc-crash/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,70 @@
+
+
+ Spring MVC XML Application
+
+
+
+ contextClass
+
+ org.springframework.web.context.support.AnnotationConfigWebApplicationContext
+
+
+
+ contextConfigLocation
+ com.baeldung.spring
+
+
+
+ org.springframework.web.context.ContextLoaderListener
+
+
+ org.crsh.plugin.WebPluginLifeCycle
+
+
+
+
+ mvc
+ org.springframework.web.servlet.DispatcherServlet
+ 1
+
+
+ mvc
+ /
+
+
+
+
+
+ ExampleOne
+ com.baeldung.jsp.ExampleOne
+
+
+ ExampleOne
+ /jsp/ExampleOne
+
+
+ ExampleThree
+ com.baeldung.jsp.ExampleThree
+
+
+ ExampleThree
+ /jsp/ExampleThree
+
+
+
+
+
+ 10
+
+
+ index.jsp
+
+
+
+ /errors
+
+
diff --git a/spring-mvc-crash/src/main/webapp/index.jsp b/spring-mvc-crash/src/main/webapp/index.jsp
new file mode 100644
index 0000000000..149fc5fe0b
--- /dev/null
+++ b/spring-mvc-crash/src/main/webapp/index.jsp
@@ -0,0 +1,20 @@
+<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
+ pageEncoding="ISO-8859-1"%>
+
+
+
+
+Spring MVC Examples
+
+
+
+ Spring MVC Examples
+
+
+
+
\ No newline at end of file
diff --git a/spring-mvc-crash/src/main/webapp/jsp/ExampleThree.jsp b/spring-mvc-crash/src/main/webapp/jsp/ExampleThree.jsp
new file mode 100644
index 0000000000..665eb86a30
--- /dev/null
+++ b/spring-mvc-crash/src/main/webapp/jsp/ExampleThree.jsp
@@ -0,0 +1,10 @@
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+
+
+ Java Binding Example
+
+
+ Bound Value
+ You said: ${text}
+
+