From 4bc6dcad27a2f4b56c6c6913fb38f0c7778d7d3f Mon Sep 17 00:00:00 2001 From: Dhawal Kapil Date: Thu, 30 Aug 2018 00:15:26 +0530 Subject: [PATCH] BAEL-8507 Merge spring-data-spring-security into another appropriate module - Removed project spring-data-spring-security and moved its content in spring-security-mvc-boot --- spring-data-spring-security/README.md | 14 ---- spring-data-spring-security/pom.xml | 64 ------------------- .../src/main/resources/application.properties | 0 .../src/main/resources/logback.xml | 13 ---- spring-security-mvc-boot/README.MD | 1 + spring-security-mvc-boot/pom.xml | 4 ++ .../src/main/java/com/baeldung/AppConfig.java | 0 .../com/baeldung/SpringSecurityConfig.java | 0 .../data/repositories/TweetRepository.java | 0 .../data/repositories/UserRepository.java | 0 .../java/com/baeldung/models/AppUser.java | 0 .../main/java/com/baeldung/models/Tweet.java | 0 .../baeldung/security/AppUserPrincipal.java | 0 .../AuthenticationSuccessHandlerImpl.java | 0 .../security/CustomUserDetailsService.java | 0 .../com/baeldung/util/DummyContentUtil.java | 0 .../main/resources/persistence-h2.properties | 0 .../SpringDataWithSecurityUnitTest.java | 6 +- 18 files changed, 8 insertions(+), 94 deletions(-) delete mode 100644 spring-data-spring-security/README.md delete mode 100644 spring-data-spring-security/pom.xml delete mode 100644 spring-data-spring-security/src/main/resources/application.properties delete mode 100644 spring-data-spring-security/src/main/resources/logback.xml rename {spring-data-spring-security => spring-security-mvc-boot}/src/main/java/com/baeldung/AppConfig.java (100%) rename {spring-data-spring-security => spring-security-mvc-boot}/src/main/java/com/baeldung/SpringSecurityConfig.java (100%) rename {spring-data-spring-security => spring-security-mvc-boot}/src/main/java/com/baeldung/data/repositories/TweetRepository.java (100%) rename {spring-data-spring-security => spring-security-mvc-boot}/src/main/java/com/baeldung/data/repositories/UserRepository.java (100%) rename {spring-data-spring-security => spring-security-mvc-boot}/src/main/java/com/baeldung/models/AppUser.java (100%) rename {spring-data-spring-security => spring-security-mvc-boot}/src/main/java/com/baeldung/models/Tweet.java (100%) rename {spring-data-spring-security => spring-security-mvc-boot}/src/main/java/com/baeldung/security/AppUserPrincipal.java (100%) rename {spring-data-spring-security => spring-security-mvc-boot}/src/main/java/com/baeldung/security/AuthenticationSuccessHandlerImpl.java (100%) rename {spring-data-spring-security => spring-security-mvc-boot}/src/main/java/com/baeldung/security/CustomUserDetailsService.java (100%) rename {spring-data-spring-security => spring-security-mvc-boot}/src/main/java/com/baeldung/util/DummyContentUtil.java (100%) rename {spring-data-spring-security => spring-security-mvc-boot}/src/main/resources/persistence-h2.properties (100%) rename spring-data-spring-security/src/test/java/com/baeldung/relationships/SpringDataWithSecurityTest.java => spring-security-mvc-boot/src/test/java/com/baeldung/relationships/SpringDataWithSecurityUnitTest.java (95%) diff --git a/spring-data-spring-security/README.md b/spring-data-spring-security/README.md deleted file mode 100644 index da65527a8a..0000000000 --- a/spring-data-spring-security/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# About this project -This project contains examples from the [Spring Data with Spring Security](http://www.baeldung.com/spring-data-with-spring-security) article from Baeldung. - -# Running the project -The application uses [Spring Boot](http://projects.spring.io/spring-boot/), so it is easy to run. You can start it any of a few ways: -* Run the `main` method from `SpringDataRestApplication` -* Use the Maven Spring Boot plugin: `mvn spring-boot:run` -* Package the application as a JAR and run it using `java -jar spring-data-spring-security.jar` - -# Viewing the running application -To view the running application, visit [http://localhost:8080](http://localhost:8080) in your browser - -###Relevant Articles: -- [Spring Data with Spring Security](http://www.baeldung.com/spring-data-security) diff --git a/spring-data-spring-security/pom.xml b/spring-data-spring-security/pom.xml deleted file mode 100644 index 09e056ef01..0000000000 --- a/spring-data-spring-security/pom.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - 4.0.0 - com.baeldung - spring-data-spring-security - 1.0 - jar - intro-spring-data-spring-security - Spring Data with Spring Security - - - parent-boot-1 - com.baeldung - 0.0.1-SNAPSHOT - ../parent-boot-1 - - - - - org.springframework.boot - spring-boot-starter - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-data-jpa - - - org.springframework.security - spring-security-data - - - org.springframework.boot - spring-boot-starter-security - - - org.springframework.security - spring-security-test - test - - - org.apache.tomcat.embed - tomcat-embed-jasper - - - - com.h2database - h2 - - - javax.servlet - jstl - - - - - ${project.artifactId} - - - diff --git a/spring-data-spring-security/src/main/resources/application.properties b/spring-data-spring-security/src/main/resources/application.properties deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/spring-data-spring-security/src/main/resources/logback.xml b/spring-data-spring-security/src/main/resources/logback.xml deleted file mode 100644 index 7d900d8ea8..0000000000 --- a/spring-data-spring-security/src/main/resources/logback.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n - - - - - - - - \ No newline at end of file diff --git a/spring-security-mvc-boot/README.MD b/spring-security-mvc-boot/README.MD index 32976b0896..0bae800b1e 100644 --- a/spring-security-mvc-boot/README.MD +++ b/spring-security-mvc-boot/README.MD @@ -9,3 +9,4 @@ The "REST With Spring" Classes: http://github.learnspringsecurity.com - [Multiple Entry Points in Spring Security](http://www.baeldung.com/spring-security-multiple-entry-points) - [Multiple Authentication Providers in Spring Security](http://www.baeldung.com/spring-security-multiple-auth-providers) - [Granted Authority Versus Role in Spring Security](http://www.baeldung.com/spring-security-granted-authority-vs-role) +- [Spring Data with Spring Security] (https://www.baeldung.com/spring-data-security) diff --git a/spring-security-mvc-boot/pom.xml b/spring-security-mvc-boot/pom.xml index a894c5713a..4090beab99 100644 --- a/spring-security-mvc-boot/pom.xml +++ b/spring-security-mvc-boot/pom.xml @@ -42,6 +42,10 @@ org.springframework.boot spring-boot-starter-data-jpa + + org.springframework.security + spring-security-data + com.h2database h2 diff --git a/spring-data-spring-security/src/main/java/com/baeldung/AppConfig.java b/spring-security-mvc-boot/src/main/java/com/baeldung/AppConfig.java similarity index 100% rename from spring-data-spring-security/src/main/java/com/baeldung/AppConfig.java rename to spring-security-mvc-boot/src/main/java/com/baeldung/AppConfig.java diff --git a/spring-data-spring-security/src/main/java/com/baeldung/SpringSecurityConfig.java b/spring-security-mvc-boot/src/main/java/com/baeldung/SpringSecurityConfig.java similarity index 100% rename from spring-data-spring-security/src/main/java/com/baeldung/SpringSecurityConfig.java rename to spring-security-mvc-boot/src/main/java/com/baeldung/SpringSecurityConfig.java diff --git a/spring-data-spring-security/src/main/java/com/baeldung/data/repositories/TweetRepository.java b/spring-security-mvc-boot/src/main/java/com/baeldung/data/repositories/TweetRepository.java similarity index 100% rename from spring-data-spring-security/src/main/java/com/baeldung/data/repositories/TweetRepository.java rename to spring-security-mvc-boot/src/main/java/com/baeldung/data/repositories/TweetRepository.java diff --git a/spring-data-spring-security/src/main/java/com/baeldung/data/repositories/UserRepository.java b/spring-security-mvc-boot/src/main/java/com/baeldung/data/repositories/UserRepository.java similarity index 100% rename from spring-data-spring-security/src/main/java/com/baeldung/data/repositories/UserRepository.java rename to spring-security-mvc-boot/src/main/java/com/baeldung/data/repositories/UserRepository.java diff --git a/spring-data-spring-security/src/main/java/com/baeldung/models/AppUser.java b/spring-security-mvc-boot/src/main/java/com/baeldung/models/AppUser.java similarity index 100% rename from spring-data-spring-security/src/main/java/com/baeldung/models/AppUser.java rename to spring-security-mvc-boot/src/main/java/com/baeldung/models/AppUser.java diff --git a/spring-data-spring-security/src/main/java/com/baeldung/models/Tweet.java b/spring-security-mvc-boot/src/main/java/com/baeldung/models/Tweet.java similarity index 100% rename from spring-data-spring-security/src/main/java/com/baeldung/models/Tweet.java rename to spring-security-mvc-boot/src/main/java/com/baeldung/models/Tweet.java diff --git a/spring-data-spring-security/src/main/java/com/baeldung/security/AppUserPrincipal.java b/spring-security-mvc-boot/src/main/java/com/baeldung/security/AppUserPrincipal.java similarity index 100% rename from spring-data-spring-security/src/main/java/com/baeldung/security/AppUserPrincipal.java rename to spring-security-mvc-boot/src/main/java/com/baeldung/security/AppUserPrincipal.java diff --git a/spring-data-spring-security/src/main/java/com/baeldung/security/AuthenticationSuccessHandlerImpl.java b/spring-security-mvc-boot/src/main/java/com/baeldung/security/AuthenticationSuccessHandlerImpl.java similarity index 100% rename from spring-data-spring-security/src/main/java/com/baeldung/security/AuthenticationSuccessHandlerImpl.java rename to spring-security-mvc-boot/src/main/java/com/baeldung/security/AuthenticationSuccessHandlerImpl.java diff --git a/spring-data-spring-security/src/main/java/com/baeldung/security/CustomUserDetailsService.java b/spring-security-mvc-boot/src/main/java/com/baeldung/security/CustomUserDetailsService.java similarity index 100% rename from spring-data-spring-security/src/main/java/com/baeldung/security/CustomUserDetailsService.java rename to spring-security-mvc-boot/src/main/java/com/baeldung/security/CustomUserDetailsService.java diff --git a/spring-data-spring-security/src/main/java/com/baeldung/util/DummyContentUtil.java b/spring-security-mvc-boot/src/main/java/com/baeldung/util/DummyContentUtil.java similarity index 100% rename from spring-data-spring-security/src/main/java/com/baeldung/util/DummyContentUtil.java rename to spring-security-mvc-boot/src/main/java/com/baeldung/util/DummyContentUtil.java diff --git a/spring-data-spring-security/src/main/resources/persistence-h2.properties b/spring-security-mvc-boot/src/main/resources/persistence-h2.properties similarity index 100% rename from spring-data-spring-security/src/main/resources/persistence-h2.properties rename to spring-security-mvc-boot/src/main/resources/persistence-h2.properties diff --git a/spring-data-spring-security/src/test/java/com/baeldung/relationships/SpringDataWithSecurityTest.java b/spring-security-mvc-boot/src/test/java/com/baeldung/relationships/SpringDataWithSecurityUnitTest.java similarity index 95% rename from spring-data-spring-security/src/test/java/com/baeldung/relationships/SpringDataWithSecurityTest.java rename to spring-security-mvc-boot/src/test/java/com/baeldung/relationships/SpringDataWithSecurityUnitTest.java index dbbfe7e85e..8207363a70 100644 --- a/spring-data-spring-security/src/test/java/com/baeldung/relationships/SpringDataWithSecurityTest.java +++ b/spring-security-mvc-boot/src/test/java/com/baeldung/relationships/SpringDataWithSecurityUnitTest.java @@ -36,7 +36,7 @@ import com.baeldung.util.DummyContentUtil; @WebAppConfiguration @ContextConfiguration @DirtiesContext -public class SpringDataWithSecurityTest { +public class SpringDataWithSecurityUnitTest { AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext(); @Autowired private ServletContext servletContext; @@ -50,8 +50,8 @@ public class SpringDataWithSecurityTest { ctx.refresh(); userRepository = ctx.getBean(UserRepository.class); tweetRepository = ctx.getBean(TweetRepository.class); - List appUsers = (List) userRepository.save(DummyContentUtil.generateDummyUsers()); - tweetRepository.save(DummyContentUtil.generateDummyTweets(appUsers)); + List appUsers = (List) userRepository.saveAll(DummyContentUtil.generateDummyUsers()); + tweetRepository.saveAll(DummyContentUtil.generateDummyTweets(appUsers)); } @AfterClass