diff --git a/pom.xml b/pom.xml index 630077b1a4..b8978ab067 100644 --- a/pom.xml +++ b/pom.xml @@ -780,6 +780,7 @@ spring-mobile spring-mockito + spring-websockets spring-mvc-basics-4 spring-mvc-forms-jsp spring-mvc-forms-thymeleaf @@ -1377,6 +1378,7 @@ spring-mobile spring-mockito + spring-websockets spring-mvc-forms-jsp spring-mvc-forms-thymeleaf spring-mvc-java diff --git a/spring-aop/README.md b/spring-aop/README.md index 061e736d31..4522cd63c1 100644 --- a/spring-aop/README.md +++ b/spring-aop/README.md @@ -3,8 +3,9 @@ This module contains articles about Spring aspect oriented programming (AOP) ### Relevant articles - - [Implementing a Custom Spring AOP Annotation](https://www.baeldung.com/spring-aop-annotation) - [Intro to AspectJ](https://www.baeldung.com/aspectj) - [Spring Performance Logging](https://www.baeldung.com/spring-performance-logging) - [Introduction to Spring AOP](https://www.baeldung.com/spring-aop) +- [Introduction to Pointcut Expressions in Spring](https://www.baeldung.com/spring-aop-pointcut-tutorial) +- [Introduction to Advice Types in Spring](https://www.baeldung.com/spring-aop-advice-tutorial) \ No newline at end of file diff --git a/spring-mvc-java/src/main/java/com/baeldung/model/Foo.java b/spring-aop/src/main/java/com/baeldung/pointcutadvice/Foo.java similarity index 76% rename from spring-mvc-java/src/main/java/com/baeldung/model/Foo.java rename to spring-aop/src/main/java/com/baeldung/pointcutadvice/Foo.java index 01f5f43f60..b20c9a3ccf 100644 --- a/spring-mvc-java/src/main/java/com/baeldung/model/Foo.java +++ b/spring-aop/src/main/java/com/baeldung/pointcutadvice/Foo.java @@ -1,6 +1,6 @@ -package com.baeldung.model; +package com.baeldung.pointcutadvice; -import com.baeldung.aop.annotations.Entity; +import com.baeldung.pointcutadvice.annotations.Entity; @Entity public class Foo { diff --git a/spring-mvc-java/src/main/java/com/baeldung/aop/LoggingAspect.java b/spring-aop/src/main/java/com/baeldung/pointcutadvice/LoggingAspect.java similarity index 87% rename from spring-mvc-java/src/main/java/com/baeldung/aop/LoggingAspect.java rename to spring-aop/src/main/java/com/baeldung/pointcutadvice/LoggingAspect.java index 169d664471..481e1d323a 100644 --- a/spring-mvc-java/src/main/java/com/baeldung/aop/LoggingAspect.java +++ b/spring-aop/src/main/java/com/baeldung/pointcutadvice/LoggingAspect.java @@ -1,4 +1,4 @@ -package com.baeldung.aop; +package com.baeldung.pointcutadvice; import org.aspectj.lang.JoinPoint; import org.aspectj.lang.annotation.Aspect; @@ -23,15 +23,15 @@ public class LoggingAspect { } }; - @Pointcut("within(com.baeldung..*) && execution(* com.baeldung.dao.FooDao.*(..))") + @Pointcut("within(com.baeldung..*) && execution(* com.baeldung.pointcutadvice.dao.FooDao.*(..))") public void repositoryMethods() { } - @Pointcut("within(com.baeldung..*) && @annotation(com.baeldung.aop.annotations.Loggable)") + @Pointcut("within(com.baeldung..*) && @annotation(com.baeldung.pointcutadvice.annotations.Loggable)") public void loggableMethods() { } - @Pointcut("within(com.baeldung..*) && @args(com.baeldung.aop.annotations.Entity)") + @Pointcut("within(com.baeldung..*) && @args(com.baeldung.pointcutadvice.annotations.Entity)") public void methodsAcceptingEntities() { } diff --git a/spring-mvc-java/src/main/java/com/baeldung/aop/PerformanceAspect.java b/spring-aop/src/main/java/com/baeldung/pointcutadvice/PerformanceAspect.java similarity index 93% rename from spring-mvc-java/src/main/java/com/baeldung/aop/PerformanceAspect.java rename to spring-aop/src/main/java/com/baeldung/pointcutadvice/PerformanceAspect.java index 8f374cc1e5..4f445e301e 100644 --- a/spring-mvc-java/src/main/java/com/baeldung/aop/PerformanceAspect.java +++ b/spring-aop/src/main/java/com/baeldung/pointcutadvice/PerformanceAspect.java @@ -1,4 +1,4 @@ -package com.baeldung.aop; +package com.baeldung.pointcutadvice; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; @@ -15,7 +15,7 @@ public class PerformanceAspect { private static Logger logger = Logger.getLogger(PerformanceAspect.class.getName()); - @Pointcut("within(com.baeldung..*) && execution(* com.baeldung.dao.FooDao.*(..))") + @Pointcut("within(com.baeldung..*) && execution(* com.baeldung.pointcutadvice.dao.FooDao.*(..))") public void repositoryClassMethods() { } diff --git a/spring-mvc-java/src/main/java/com/baeldung/aop/PublishingAspect.java b/spring-aop/src/main/java/com/baeldung/pointcutadvice/PublishingAspect.java similarity index 86% rename from spring-mvc-java/src/main/java/com/baeldung/aop/PublishingAspect.java rename to spring-aop/src/main/java/com/baeldung/pointcutadvice/PublishingAspect.java index a45402dc18..bb96e08772 100644 --- a/spring-mvc-java/src/main/java/com/baeldung/aop/PublishingAspect.java +++ b/spring-aop/src/main/java/com/baeldung/pointcutadvice/PublishingAspect.java @@ -1,6 +1,6 @@ -package com.baeldung.aop; +package com.baeldung.pointcutadvice; -import com.baeldung.events.FooCreationEvent; +import com.baeldung.pointcutadvice.events.FooCreationEvent; import org.aspectj.lang.JoinPoint; import org.aspectj.lang.annotation.AfterReturning; import org.aspectj.lang.annotation.Aspect; @@ -20,11 +20,11 @@ public class PublishingAspect { this.eventPublisher = eventPublisher; } - @Pointcut("within(com.baeldung..*) && execution(* com.baeldung.dao.FooDao.*(..))") + @Pointcut("within(com.baeldung..*) && execution(* com.baeldung.pointcutadvice.dao.FooDao.*(..))") public void repositoryMethods() { } - @Pointcut("within(com.baeldung..*) && execution(* com.baeldung.dao.FooDao.create*(Long,..))") + @Pointcut("within(com.baeldung..*) && execution(* com.baeldung.pointcutadvice.dao.FooDao.create*(Long,..))") public void firstLongParamMethods() { } diff --git a/spring-mvc-java/src/main/java/com/baeldung/aop/annotations/Entity.java b/spring-aop/src/main/java/com/baeldung/pointcutadvice/annotations/Entity.java similarity index 83% rename from spring-mvc-java/src/main/java/com/baeldung/aop/annotations/Entity.java rename to spring-aop/src/main/java/com/baeldung/pointcutadvice/annotations/Entity.java index 61d91b0777..e6753cdd61 100644 --- a/spring-mvc-java/src/main/java/com/baeldung/aop/annotations/Entity.java +++ b/spring-aop/src/main/java/com/baeldung/pointcutadvice/annotations/Entity.java @@ -1,4 +1,4 @@ -package com.baeldung.aop.annotations; +package com.baeldung.pointcutadvice.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; diff --git a/spring-mvc-java/src/main/java/com/baeldung/aop/annotations/Loggable.java b/spring-aop/src/main/java/com/baeldung/pointcutadvice/annotations/Loggable.java similarity index 84% rename from spring-mvc-java/src/main/java/com/baeldung/aop/annotations/Loggable.java rename to spring-aop/src/main/java/com/baeldung/pointcutadvice/annotations/Loggable.java index 92aa950e58..921003be63 100644 --- a/spring-mvc-java/src/main/java/com/baeldung/aop/annotations/Loggable.java +++ b/spring-aop/src/main/java/com/baeldung/pointcutadvice/annotations/Loggable.java @@ -1,4 +1,4 @@ -package com.baeldung.aop.annotations; +package com.baeldung.pointcutadvice.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; diff --git a/spring-mvc-java/src/main/java/com/baeldung/dao/FooDao.java b/spring-aop/src/main/java/com/baeldung/pointcutadvice/dao/FooDao.java similarity index 69% rename from spring-mvc-java/src/main/java/com/baeldung/dao/FooDao.java rename to spring-aop/src/main/java/com/baeldung/pointcutadvice/dao/FooDao.java index 1d28b082ec..72a9762991 100644 --- a/spring-mvc-java/src/main/java/com/baeldung/dao/FooDao.java +++ b/spring-aop/src/main/java/com/baeldung/pointcutadvice/dao/FooDao.java @@ -1,7 +1,7 @@ -package com.baeldung.dao; +package com.baeldung.pointcutadvice.dao; -import com.baeldung.aop.annotations.Loggable; -import com.baeldung.model.Foo; +import com.baeldung.pointcutadvice.Foo; +import com.baeldung.pointcutadvice.annotations.Loggable; import org.springframework.stereotype.Repository; @Repository diff --git a/spring-mvc-java/src/main/java/com/baeldung/events/FooCreationEvent.java b/spring-aop/src/main/java/com/baeldung/pointcutadvice/events/FooCreationEvent.java similarity index 81% rename from spring-mvc-java/src/main/java/com/baeldung/events/FooCreationEvent.java rename to spring-aop/src/main/java/com/baeldung/pointcutadvice/events/FooCreationEvent.java index 5ea4b46c04..8cee80fa0c 100644 --- a/spring-mvc-java/src/main/java/com/baeldung/events/FooCreationEvent.java +++ b/spring-aop/src/main/java/com/baeldung/pointcutadvice/events/FooCreationEvent.java @@ -1,4 +1,4 @@ -package com.baeldung.events; +package com.baeldung.pointcutadvice.events; import org.springframework.context.ApplicationEvent; diff --git a/spring-mvc-java/src/main/java/com/baeldung/events/FooCreationEventListener.java b/spring-aop/src/main/java/com/baeldung/pointcutadvice/events/FooCreationEventListener.java similarity index 91% rename from spring-mvc-java/src/main/java/com/baeldung/events/FooCreationEventListener.java rename to spring-aop/src/main/java/com/baeldung/pointcutadvice/events/FooCreationEventListener.java index c0aa744bc1..4a55b2138d 100644 --- a/spring-mvc-java/src/main/java/com/baeldung/events/FooCreationEventListener.java +++ b/spring-aop/src/main/java/com/baeldung/pointcutadvice/events/FooCreationEventListener.java @@ -1,4 +1,4 @@ -package com.baeldung.events; +package com.baeldung.pointcutadvice.events; import org.springframework.context.ApplicationListener; import org.springframework.stereotype.Component; diff --git a/spring-mvc-java/src/main/resources/com/baeldung/aop/beans.xml b/spring-aop/src/main/resources/pointcutadvice/beans.xml similarity index 83% rename from spring-mvc-java/src/main/resources/com/baeldung/aop/beans.xml rename to spring-aop/src/main/resources/pointcutadvice/beans.xml index e6aa9d77c4..ad96827a13 100644 --- a/spring-mvc-java/src/main/resources/com/baeldung/aop/beans.xml +++ b/spring-aop/src/main/resources/pointcutadvice/beans.xml @@ -7,8 +7,8 @@ http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.2.xsd"> - - + + diff --git a/spring-mvc-java/src/test/java/com/baeldung/config/TestConfig.java b/spring-aop/src/test/java/com/baeldung/TestConfig.java similarity index 67% rename from spring-mvc-java/src/test/java/com/baeldung/config/TestConfig.java rename to spring-aop/src/test/java/com/baeldung/TestConfig.java index 641513a24a..e5db2508e4 100644 --- a/spring-mvc-java/src/test/java/com/baeldung/config/TestConfig.java +++ b/spring-aop/src/test/java/com/baeldung/TestConfig.java @@ -1,11 +1,11 @@ -package com.baeldung.config; +package com.baeldung; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.EnableAspectJAutoProxy; @Configuration -@ComponentScan(basePackages = { "com.baeldung.dao", "com.baeldung.aop", "com.baeldung.events" }) +@ComponentScan(basePackages = { "com.baeldung.pointcutadvice" }) @EnableAspectJAutoProxy public class TestConfig { } diff --git a/spring-mvc-java/src/test/java/com/baeldung/aop/AopLoggingIntegrationTest.java b/spring-aop/src/test/java/com/baeldung/pointcutadvice/AopLoggingIntegrationTest.java similarity index 95% rename from spring-mvc-java/src/test/java/com/baeldung/aop/AopLoggingIntegrationTest.java rename to spring-aop/src/test/java/com/baeldung/pointcutadvice/AopLoggingIntegrationTest.java index 698bae4c0f..eff3d2eb19 100644 --- a/spring-mvc-java/src/test/java/com/baeldung/aop/AopLoggingIntegrationTest.java +++ b/spring-aop/src/test/java/com/baeldung/pointcutadvice/AopLoggingIntegrationTest.java @@ -1,8 +1,7 @@ -package com.baeldung.aop; +package com.baeldung.pointcutadvice; -import com.baeldung.config.TestConfig; -import com.baeldung.dao.FooDao; -import com.baeldung.model.Foo; +import com.baeldung.TestConfig; +import com.baeldung.pointcutadvice.dao.FooDao; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/spring-mvc-java/src/test/java/com/baeldung/aop/AopPerformanceIntegrationTest.java b/spring-aop/src/test/java/com/baeldung/pointcutadvice/AopPerformanceIntegrationTest.java similarity index 94% rename from spring-mvc-java/src/test/java/com/baeldung/aop/AopPerformanceIntegrationTest.java rename to spring-aop/src/test/java/com/baeldung/pointcutadvice/AopPerformanceIntegrationTest.java index c9ab2fb4bb..452609d730 100644 --- a/spring-mvc-java/src/test/java/com/baeldung/aop/AopPerformanceIntegrationTest.java +++ b/spring-aop/src/test/java/com/baeldung/pointcutadvice/AopPerformanceIntegrationTest.java @@ -1,7 +1,7 @@ -package com.baeldung.aop; +package com.baeldung.pointcutadvice; -import com.baeldung.config.TestConfig; -import com.baeldung.dao.FooDao; +import com.baeldung.TestConfig; +import com.baeldung.pointcutadvice.dao.FooDao; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/spring-mvc-java/src/test/java/com/baeldung/aop/AopPublishingIntegrationTest.java b/spring-aop/src/test/java/com/baeldung/pointcutadvice/AopPublishingIntegrationTest.java similarity index 90% rename from spring-mvc-java/src/test/java/com/baeldung/aop/AopPublishingIntegrationTest.java rename to spring-aop/src/test/java/com/baeldung/pointcutadvice/AopPublishingIntegrationTest.java index 2503900e69..559dc52cb5 100644 --- a/spring-mvc-java/src/test/java/com/baeldung/aop/AopPublishingIntegrationTest.java +++ b/spring-aop/src/test/java/com/baeldung/pointcutadvice/AopPublishingIntegrationTest.java @@ -1,9 +1,8 @@ -package com.baeldung.aop; +package com.baeldung.pointcutadvice; -import com.baeldung.config.TestConfig; -import com.baeldung.dao.FooDao; -import com.baeldung.events.FooCreationEventListener; -import com.baeldung.model.Foo; +import com.baeldung.TestConfig; +import com.baeldung.pointcutadvice.dao.FooDao; +import com.baeldung.pointcutadvice.events.FooCreationEventListener; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/spring-mvc-java/src/test/java/com/baeldung/aop/AopXmlConfigPerformanceIntegrationTest.java b/spring-aop/src/test/java/com/baeldung/pointcutadvice/AopXmlConfigPerformanceIntegrationTest.java similarity index 93% rename from spring-mvc-java/src/test/java/com/baeldung/aop/AopXmlConfigPerformanceIntegrationTest.java rename to spring-aop/src/test/java/com/baeldung/pointcutadvice/AopXmlConfigPerformanceIntegrationTest.java index 3b380315e8..5727cfd7bc 100644 --- a/spring-mvc-java/src/test/java/com/baeldung/aop/AopXmlConfigPerformanceIntegrationTest.java +++ b/spring-aop/src/test/java/com/baeldung/pointcutadvice/AopXmlConfigPerformanceIntegrationTest.java @@ -1,6 +1,6 @@ -package com.baeldung.aop; +package com.baeldung.pointcutadvice; -import com.baeldung.dao.FooDao; +import com.baeldung.pointcutadvice.dao.FooDao; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -21,7 +21,7 @@ import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; @RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration("/com/baeldung/aop/beans.xml") +@ContextConfiguration("/pointcutadvice/beans.xml") public class AopXmlConfigPerformanceIntegrationTest { @Before diff --git a/spring-mvc-java/README.md b/spring-mvc-java/README.md index 7088162496..4859e28147 100644 --- a/spring-mvc-java/README.md +++ b/spring-mvc-java/README.md @@ -7,17 +7,13 @@ This module contains articles about Spring MVC with Java configuration The "REST With Spring" Classes: http://bit.ly/restwithspring ### Relevant Articles: -- [Introduction to Pointcut Expressions in Spring](https://www.baeldung.com/spring-aop-pointcut-tutorial) -- [Introduction to Advice Types in Spring](https://www.baeldung.com/spring-aop-advice-tutorial) - [Integration Testing in Spring](https://www.baeldung.com/integration-testing-in-spring) - [A Quick Guide to Spring MVC Matrix Variables](https://www.baeldung.com/spring-mvc-matrix-variables) -- [Intro to WebSockets with Spring](https://www.baeldung.com/websockets-spring) - [File Upload with Spring MVC](https://www.baeldung.com/spring-file-upload) - [Introduction to HtmlUnit](https://www.baeldung.com/htmlunit) - [Upload and Display Excel Files with Spring MVC](https://www.baeldung.com/spring-mvc-excel-files) - [web.xml vs Initializer with Spring](https://www.baeldung.com/spring-xml-vs-java-config) - [Spring MVC @PathVariable with a dot (.) gets truncated](https://www.baeldung.com/spring-mvc-pathvariable-dot) -- [A Quick Example of Spring Websockets’ @SendToUser Annotation](https://www.baeldung.com/spring-websockets-sendtouser) - [Working with Date Parameters in Spring](https://www.baeldung.com/spring-date-parameters) - [A Java Web Application Without a web.xml](https://www.baeldung.com/java-web-app-without-web-xml) - [The HttpMediaTypeNotAcceptableException in Spring MVC](https://www.baeldung.com/spring-httpmediatypenotacceptable) diff --git a/spring-mvc-java/pom.xml b/spring-mvc-java/pom.xml index dd197bbeb5..079a664a5d 100644 --- a/spring-mvc-java/pom.xml +++ b/spring-mvc-java/pom.xml @@ -48,19 +48,6 @@ jackson-databind ${jackson.version} - - - - org.aspectj - aspectjrt - ${aspectjrt.version} - - - org.aspectj - aspectjweaver - ${aspectjweaver.version} - - net.sourceforge.htmlunit @@ -120,18 +107,6 @@ hibernate-validator ${hibernate-validator.version} - - - - - com.google.code.gson - gson - ${gson.version} - - - org.springframework.boot - spring-boot-starter-websocket - org.glassfish javax.el @@ -285,11 +260,8 @@ 3.0.1-b09 4.0.1 2.3.3 - 1.9.1 - 1.9.1 2.32 2.4.0 - 2.8.5 com.baeldung.SpringMVCApplication diff --git a/spring-mvc-java/src/test/java/com/baeldung/SpringContextTest.java b/spring-mvc-java/src/test/java/com/baeldung/SpringContextTest.java deleted file mode 100644 index 8943ecb548..0000000000 --- a/spring-mvc-java/src/test/java/com/baeldung/SpringContextTest.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.config.TestConfig; - -@RunWith(SpringRunner.class) -@ContextConfiguration(classes = {TestConfig.class}) -public class SpringContextTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - - } -} diff --git a/spring-websockets/README.md b/spring-websockets/README.md new file mode 100644 index 0000000000..26e1c6db7c --- /dev/null +++ b/spring-websockets/README.md @@ -0,0 +1,7 @@ +## Spring WebSockets + +This module contains articles about Spring WebSockets. + +### Relevant articles +- [Intro to WebSockets with Spring](https://www.baeldung.com/websockets-spring) +- [A Quick Example of Spring Websockets’ @SendToUser Annotation](https://www.baeldung.com/spring-websockets-sendtouser) diff --git a/spring-websockets/pom.xml b/spring-websockets/pom.xml new file mode 100644 index 0000000000..ddfd512476 --- /dev/null +++ b/spring-websockets/pom.xml @@ -0,0 +1,37 @@ + + + 4.0.0 + spring-websockets + spring-websockets + war + + + com.baeldung + parent-boot-2 + 0.0.1-SNAPSHOT + ../parent-boot-2 + + + + + org.springframework.boot + spring-boot-starter-websocket + + + com.google.code.gson + gson + + + + + spring-websockets + + + src/main/resources + true + + + + + diff --git a/spring-websockets/src/main/java/com/baeldung/SpringBootApp.java b/spring-websockets/src/main/java/com/baeldung/SpringBootApp.java new file mode 100644 index 0000000000..ea2a461dfc --- /dev/null +++ b/spring-websockets/src/main/java/com/baeldung/SpringBootApp.java @@ -0,0 +1,12 @@ +package com.baeldung; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; + +@SpringBootApplication +public class SpringBootApp extends SpringBootServletInitializer { + public static void main(String[] args) { + SpringApplication.run(SpringBootApp.class, args); + } +} \ No newline at end of file diff --git a/spring-mvc-java/src/main/java/com/baeldung/spring/web/config/WebSocketSendToUserConfig.java b/spring-websockets/src/main/java/com/baeldung/sendtouser/WebSocketSendToUserConfig.java similarity index 98% rename from spring-mvc-java/src/main/java/com/baeldung/spring/web/config/WebSocketSendToUserConfig.java rename to spring-websockets/src/main/java/com/baeldung/sendtouser/WebSocketSendToUserConfig.java index dbd52e20ba..76837d27f5 100644 --- a/spring-mvc-java/src/main/java/com/baeldung/spring/web/config/WebSocketSendToUserConfig.java +++ b/spring-websockets/src/main/java/com/baeldung/sendtouser/WebSocketSendToUserConfig.java @@ -1,4 +1,4 @@ -package com.baeldung.spring.web.config; +package com.baeldung.sendtouser; import org.springframework.context.annotation.Configuration; import org.springframework.http.server.ServerHttpRequest; diff --git a/spring-mvc-java/src/main/java/com/baeldung/web/controller/WebsocketSendToUserController.java b/spring-websockets/src/main/java/com/baeldung/sendtouser/WebsocketSendToUserController.java similarity index 96% rename from spring-mvc-java/src/main/java/com/baeldung/web/controller/WebsocketSendToUserController.java rename to spring-websockets/src/main/java/com/baeldung/sendtouser/WebsocketSendToUserController.java index 4b55bcc00f..12475ad055 100644 --- a/spring-mvc-java/src/main/java/com/baeldung/web/controller/WebsocketSendToUserController.java +++ b/spring-websockets/src/main/java/com/baeldung/sendtouser/WebsocketSendToUserController.java @@ -1,15 +1,14 @@ -package com.baeldung.web.controller; - -import java.security.Principal; -import java.util.Map; +package com.baeldung.sendtouser; +import com.google.gson.Gson; import org.springframework.messaging.handler.annotation.MessageExceptionHandler; import org.springframework.messaging.handler.annotation.MessageMapping; import org.springframework.messaging.handler.annotation.Payload; import org.springframework.messaging.simp.annotation.SendToUser; import org.springframework.stereotype.Controller; -import com.google.gson.Gson; +import java.security.Principal; +import java.util.Map; @Controller public class WebsocketSendToUserController { diff --git a/spring-mvc-java/src/main/java/com/baeldung/web/controller/ChatController.java b/spring-websockets/src/main/java/com/baeldung/websockets/ChatController.java similarity index 83% rename from spring-mvc-java/src/main/java/com/baeldung/web/controller/ChatController.java rename to spring-websockets/src/main/java/com/baeldung/websockets/ChatController.java index f4bed1950b..4ac78c2730 100644 --- a/spring-mvc-java/src/main/java/com/baeldung/web/controller/ChatController.java +++ b/spring-websockets/src/main/java/com/baeldung/websockets/ChatController.java @@ -1,7 +1,5 @@ -package com.baeldung.web.controller; +package com.baeldung.websockets; -import com.baeldung.model.Message; -import com.baeldung.model.OutputMessage; import org.springframework.messaging.handler.annotation.MessageMapping; import org.springframework.messaging.handler.annotation.SendTo; import org.springframework.stereotype.Controller; diff --git a/spring-mvc-java/src/main/java/com/baeldung/model/Message.java b/spring-websockets/src/main/java/com/baeldung/websockets/Message.java similarity index 85% rename from spring-mvc-java/src/main/java/com/baeldung/model/Message.java rename to spring-websockets/src/main/java/com/baeldung/websockets/Message.java index 76d53e132a..dd147a7bf5 100644 --- a/spring-mvc-java/src/main/java/com/baeldung/model/Message.java +++ b/spring-websockets/src/main/java/com/baeldung/websockets/Message.java @@ -1,4 +1,4 @@ -package com.baeldung.model; +package com.baeldung.websockets; public class Message { diff --git a/spring-mvc-java/src/main/java/com/baeldung/model/OutputMessage.java b/spring-websockets/src/main/java/com/baeldung/websockets/OutputMessage.java similarity index 93% rename from spring-mvc-java/src/main/java/com/baeldung/model/OutputMessage.java rename to spring-websockets/src/main/java/com/baeldung/websockets/OutputMessage.java index 9aad564b1e..33d1f42743 100644 --- a/spring-mvc-java/src/main/java/com/baeldung/model/OutputMessage.java +++ b/spring-websockets/src/main/java/com/baeldung/websockets/OutputMessage.java @@ -1,4 +1,4 @@ -package com.baeldung.model; +package com.baeldung.websockets; public class OutputMessage { diff --git a/spring-mvc-java/src/main/java/com/baeldung/spring/web/config/WebSocketConfig.java b/spring-websockets/src/main/java/com/baeldung/websockets/WebSocketConfig.java similarity index 95% rename from spring-mvc-java/src/main/java/com/baeldung/spring/web/config/WebSocketConfig.java rename to spring-websockets/src/main/java/com/baeldung/websockets/WebSocketConfig.java index 0793658e90..7b53dbc3f3 100644 --- a/spring-mvc-java/src/main/java/com/baeldung/spring/web/config/WebSocketConfig.java +++ b/spring-websockets/src/main/java/com/baeldung/websockets/WebSocketConfig.java @@ -1,4 +1,4 @@ -package com.baeldung.spring.web.config; +package com.baeldung.websockets; import org.springframework.context.annotation.Configuration; import org.springframework.messaging.simp.config.MessageBrokerRegistry; diff --git a/spring-mvc-java/src/main/webapp/resources/chat.html b/spring-websockets/src/main/webapp/resources/chat.html similarity index 96% rename from spring-mvc-java/src/main/webapp/resources/chat.html rename to spring-websockets/src/main/webapp/resources/chat.html index 92a54534fd..17c8494dd8 100644 --- a/spring-mvc-java/src/main/webapp/resources/chat.html +++ b/spring-websockets/src/main/webapp/resources/chat.html @@ -1,88 +1,88 @@ - - - Chat WebSocket - - - - - - - - - - -
- - -
- -
-
-
- - -
-
-
- - -

-
-
- - + + + Chat WebSocket + + + + + + + + + + +
+ + +
+ +
+
+
+ + +
+
+
+ + +

+
+
+ + \ No newline at end of file diff --git a/spring-mvc-java/src/main/webapp/resources/js/sockjs-0.3.4.js b/spring-websockets/src/main/webapp/resources/js/sockjs-0.3.4.js similarity index 100% rename from spring-mvc-java/src/main/webapp/resources/js/sockjs-0.3.4.js rename to spring-websockets/src/main/webapp/resources/js/sockjs-0.3.4.js diff --git a/spring-mvc-java/src/main/webapp/resources/js/stomp.js b/spring-websockets/src/main/webapp/resources/js/stomp.js similarity index 100% rename from spring-mvc-java/src/main/webapp/resources/js/stomp.js rename to spring-websockets/src/main/webapp/resources/js/stomp.js diff --git a/spring-mvc-java/src/main/webapp/resources/js/webSocketSendToUserApp.js b/spring-websockets/src/main/webapp/resources/js/webSocketSendToUserApp.js similarity index 100% rename from spring-mvc-java/src/main/webapp/resources/js/webSocketSendToUserApp.js rename to spring-websockets/src/main/webapp/resources/js/webSocketSendToUserApp.js