From 2eded212580b3e810a79561a3adc227f633bc8ec Mon Sep 17 00:00:00 2001 From: Vikas Ramsingh Rajput Date: Sat, 14 Mar 2020 23:17:58 +0300 Subject: [PATCH 01/16] BAEL-3832: Difference between BeanFactory and ApplicationContext completed --- spring-core-3/pom.xml | 7 + .../bean/CustomBeanFactoryPostProcessor.java | 16 ++ .../bean/CustomBeanPostProcessor.java | 17 +++ .../baeldung/ioccontainer/bean/Student.java | 12 ++ .../ioccontainer/IOCContainerAppTest.java | 137 ++++++++++++++++++ .../ioc-container-difference-example.xml | 11 ++ 6 files changed, 200 insertions(+) create mode 100644 spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/CustomBeanFactoryPostProcessor.java create mode 100644 spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/CustomBeanPostProcessor.java create mode 100644 spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/Student.java create mode 100644 spring-core-3/src/test/java/com/baeldung/ioccontainer/IOCContainerAppTest.java create mode 100644 spring-core-3/src/test/resources/ioc-container-difference-example.xml diff --git a/spring-core-3/pom.xml b/spring-core-3/pom.xml index 205259e8e4..d1163a174c 100644 --- a/spring-core-3/pom.xml +++ b/spring-core-3/pom.xml @@ -67,6 +67,12 @@ ${junit-jupiter.version} test + + + log4j + log4j + ${log4j.version} + @@ -83,6 +89,7 @@ 2.22.1 1.3.2 2.2.2.RELEASE + 1.2.17 \ No newline at end of file diff --git a/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/CustomBeanFactoryPostProcessor.java b/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/CustomBeanFactoryPostProcessor.java new file mode 100644 index 0000000000..d6e2c92144 --- /dev/null +++ b/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/CustomBeanFactoryPostProcessor.java @@ -0,0 +1,16 @@ +package com.baeldung.ioccontainer.bean; + +import org.apache.log4j.LogManager; +import org.apache.log4j.Logger; +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.config.BeanFactoryPostProcessor; +import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; + +public class CustomBeanFactoryPostProcessor implements BeanFactoryPostProcessor { + static final Logger LOGGER = LogManager.getLogger(CustomBeanPostProcessor.class.getName()); + + @Override + public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { + LOGGER.info("BeanFactoryPostProcessor is Registered"); + } +} diff --git a/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/CustomBeanPostProcessor.java b/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/CustomBeanPostProcessor.java new file mode 100644 index 0000000000..bf34453388 --- /dev/null +++ b/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/CustomBeanPostProcessor.java @@ -0,0 +1,17 @@ +package com.baeldung.ioccontainer.bean; + +import org.apache.log4j.LogManager; +import org.apache.log4j.Logger; +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.config.BeanPostProcessor; + +public class CustomBeanPostProcessor implements BeanPostProcessor { + + static final Logger LOGGER = LogManager.getLogger(CustomBeanPostProcessor.class.getName()); + + public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { + LOGGER.info("BeanPostProcessor is Registered Before Initialization"); + return bean; + } + +} diff --git a/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/Student.java b/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/Student.java new file mode 100644 index 0000000000..e32b4ecc29 --- /dev/null +++ b/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/Student.java @@ -0,0 +1,12 @@ +package com.baeldung.ioccontainer.bean; + +import org.apache.log4j.LogManager; +import org.apache.log4j.Logger; + +public class Student { + static final Logger LOGGER = LogManager.getLogger(Student.class.getName()); + + public void postConstruct() { + LOGGER.info("Student Bean is initialized"); + } +} diff --git a/spring-core-3/src/test/java/com/baeldung/ioccontainer/IOCContainerAppTest.java b/spring-core-3/src/test/java/com/baeldung/ioccontainer/IOCContainerAppTest.java new file mode 100644 index 0000000000..b97aa08f80 --- /dev/null +++ b/spring-core-3/src/test/java/com/baeldung/ioccontainer/IOCContainerAppTest.java @@ -0,0 +1,137 @@ +package com.baeldung.ioccontainer; + +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.log4j.AppenderSkeleton; +import org.apache.log4j.Logger; +import org.apache.log4j.spi.LoggingEvent; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.BeanFactory; +import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; +import org.springframework.beans.factory.xml.XmlBeanFactory; +import org.springframework.context.ApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; +import org.springframework.core.io.ClassPathResource; +import org.springframework.core.io.Resource; + +import com.baeldung.ioccontainer.bean.CustomBeanFactoryPostProcessor; +import com.baeldung.ioccontainer.bean.CustomBeanPostProcessor; +import com.baeldung.ioccontainer.bean.Student; + +public class IOCContainerAppTest { + + private LogAppender logAppender; + private List loggingEvents; + + @BeforeEach + public void initializeLogAppender() { + logAppender = new LogAppender(); + Logger.getRootLogger() + .addAppender(logAppender); + loggingEvents = logAppender.events; + } + + @AfterEach + public void removeLogAppender() { + Logger.getRootLogger() + .removeAppender(logAppender); + } + + @Test + public void whenBFInitialized_thenNoStudentLogPrinted() { + Resource res = new ClassPathResource("ioc-container-difference-example.xml"); + BeanFactory factory = new XmlBeanFactory(res); + + String expected = "Student Bean is initialized"; + assertFalse(checkWhetherLoggerContains(expected)); + } + + @Test + public void whenBFInitialized_thenStudentLogPrinted() { + + Resource res = new ClassPathResource("ioc-container-difference-example.xml"); + BeanFactory factory = new XmlBeanFactory(res); + Student student = (Student) factory.getBean("student"); + + String expected = "Student Bean is initialized"; + assertTrue(checkWhetherLoggerContains(expected)); + } + + @Test + public void whenAppContInitialized_thenStudentObjInitialized() { + ApplicationContext context = new ClassPathXmlApplicationContext("ioc-container-difference-example.xml"); + + String expected = "Student Bean is initialized"; + assertTrue(checkWhetherLoggerContains(expected)); + } + + @Test + public void whenBFInitialized_thenBFPProcessorAndBPProcessorNotRegAutomatically() { + Resource res = new ClassPathResource("ioc-container-difference-example.xml"); + ConfigurableListableBeanFactory factory = new XmlBeanFactory(res); + + String beanFactoryPostProcessorExpectedLog = "BeanFactoryPostProcessor is Registered"; + assertFalse(checkWhetherLoggerContains(beanFactoryPostProcessorExpectedLog)); + + String beanPostProcessorExpectedLog = "BeanPostProcessor is Registered Before Initialization"; + assertFalse(checkWhetherLoggerContains(beanPostProcessorExpectedLog)); + } + + @Test + public void whenAppContInitialized_thenBFPostProcessorAndBPostProcessorRegisteredAutomatically() { + ApplicationContext context = new ClassPathXmlApplicationContext("ioc-container-difference-example.xml"); + + String beanFactoryPostProcessorExpectedLog = "BeanFactoryPostProcessor is Registered"; + assertTrue(checkWhetherLoggerContains(beanFactoryPostProcessorExpectedLog)); + + String beanPostProcessorExpectedLog = "BeanPostProcessor is Registered Before Initialization"; + assertTrue(checkWhetherLoggerContains(beanPostProcessorExpectedLog)); + } + + @Test + public void whenBFPostProcessorAndBPProcessorRegisteredManually_thenReturnTrue() { + Resource res = new ClassPathResource("ioc-container-difference-example.xml"); + ConfigurableListableBeanFactory factory = new XmlBeanFactory(res); + + CustomBeanFactoryPostProcessor beanFactoryPostProcessor = new CustomBeanFactoryPostProcessor(); + beanFactoryPostProcessor.postProcessBeanFactory(factory); + String beanFactoryPostProcessorExpectedLog = "BeanFactoryPostProcessor is Registered"; + assertTrue(checkWhetherLoggerContains(beanFactoryPostProcessorExpectedLog)); + + CustomBeanPostProcessor beanPostProcessor = new CustomBeanPostProcessor(); + factory.addBeanPostProcessor(beanPostProcessor); + Student student = (Student) factory.getBean("student"); + String beanPostProcessorExpectedLog = "BeanPostProcessor is Registered Before Initialization"; + assertTrue(checkWhetherLoggerContains(beanPostProcessorExpectedLog)); + } + + private boolean checkWhetherLoggerContains(String expectedLogMessge) { + boolean isLogExist = loggingEvents.stream() + .anyMatch(logEvent -> logEvent.getMessage() + .equals(expectedLogMessge)); + return isLogExist; + } + + public static class LogAppender extends AppenderSkeleton { + public List events = new ArrayList(); + + public void close() { + } + + public boolean requiresLayout() { + return false; + } + + @Override + protected void append(LoggingEvent event) { + events.add(event); + } + + } +} diff --git a/spring-core-3/src/test/resources/ioc-container-difference-example.xml b/spring-core-3/src/test/resources/ioc-container-difference-example.xml new file mode 100644 index 0000000000..9bb01efe66 --- /dev/null +++ b/spring-core-3/src/test/resources/ioc-container-difference-example.xml @@ -0,0 +1,11 @@ + + + + + + + + \ No newline at end of file From 5ad0170cb6423a462d1f7d685ff51c8b8992ede0 Mon Sep 17 00:00:00 2001 From: Vikas Ramsingh Rajput Date: Sun, 15 Mar 2020 10:04:16 +0300 Subject: [PATCH 02/16] BAEL-3832: renamed the unit test case as per the naming convention --- .../{IOCContainerAppTest.java => IOCContainerAppUnitTest.java} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename spring-core-3/src/test/java/com/baeldung/ioccontainer/{IOCContainerAppTest.java => IOCContainerAppUnitTest.java} (99%) diff --git a/spring-core-3/src/test/java/com/baeldung/ioccontainer/IOCContainerAppTest.java b/spring-core-3/src/test/java/com/baeldung/ioccontainer/IOCContainerAppUnitTest.java similarity index 99% rename from spring-core-3/src/test/java/com/baeldung/ioccontainer/IOCContainerAppTest.java rename to spring-core-3/src/test/java/com/baeldung/ioccontainer/IOCContainerAppUnitTest.java index b97aa08f80..66b6842d0f 100644 --- a/spring-core-3/src/test/java/com/baeldung/ioccontainer/IOCContainerAppTest.java +++ b/spring-core-3/src/test/java/com/baeldung/ioccontainer/IOCContainerAppUnitTest.java @@ -24,7 +24,7 @@ import com.baeldung.ioccontainer.bean.CustomBeanFactoryPostProcessor; import com.baeldung.ioccontainer.bean.CustomBeanPostProcessor; import com.baeldung.ioccontainer.bean.Student; -public class IOCContainerAppTest { +public class IOCContainerAppUnitTest { private LogAppender logAppender; private List loggingEvents; From 2dd0e5001b744b5902cc8e1478d1f325a8777837 Mon Sep 17 00:00:00 2001 From: Vikas Ramsingh Rajput Date: Wed, 18 Mar 2020 19:59:02 +0300 Subject: [PATCH 03/16] BAEL-3832: Removed logger checks from the test cases --- .../bean/CustomBeanFactoryPostProcessor.java | 8 +- .../bean/CustomBeanPostProcessor.java | 11 +-- .../baeldung/ioccontainer/bean/Student.java | 7 +- .../ioccontainer/IOCContainerAppUnitTest.java | 91 +++++-------------- 4 files changed, 30 insertions(+), 87 deletions(-) diff --git a/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/CustomBeanFactoryPostProcessor.java b/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/CustomBeanFactoryPostProcessor.java index d6e2c92144..fe773ce2df 100644 --- a/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/CustomBeanFactoryPostProcessor.java +++ b/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/CustomBeanFactoryPostProcessor.java @@ -1,16 +1,14 @@ package com.baeldung.ioccontainer.bean; -import org.apache.log4j.LogManager; -import org.apache.log4j.Logger; import org.springframework.beans.BeansException; import org.springframework.beans.factory.config.BeanFactoryPostProcessor; import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; public class CustomBeanFactoryPostProcessor implements BeanFactoryPostProcessor { - static final Logger LOGGER = LogManager.getLogger(CustomBeanPostProcessor.class.getName()); - + public static boolean isBeanInstantiated = false; + @Override public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { - LOGGER.info("BeanFactoryPostProcessor is Registered"); + isBeanInstantiated = true; } } diff --git a/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/CustomBeanPostProcessor.java b/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/CustomBeanPostProcessor.java index bf34453388..1c2e011a6c 100644 --- a/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/CustomBeanPostProcessor.java +++ b/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/CustomBeanPostProcessor.java @@ -1,17 +1,14 @@ package com.baeldung.ioccontainer.bean; -import org.apache.log4j.LogManager; -import org.apache.log4j.Logger; import org.springframework.beans.BeansException; import org.springframework.beans.factory.config.BeanPostProcessor; public class CustomBeanPostProcessor implements BeanPostProcessor { - - static final Logger LOGGER = LogManager.getLogger(CustomBeanPostProcessor.class.getName()); - + public static boolean isBeanInstantiated = false; + + @Override public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { - LOGGER.info("BeanPostProcessor is Registered Before Initialization"); + isBeanInstantiated = true; return bean; } - } diff --git a/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/Student.java b/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/Student.java index e32b4ecc29..03e0b049ba 100644 --- a/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/Student.java +++ b/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/Student.java @@ -1,12 +1,9 @@ package com.baeldung.ioccontainer.bean; -import org.apache.log4j.LogManager; -import org.apache.log4j.Logger; - public class Student { - static final Logger LOGGER = LogManager.getLogger(Student.class.getName()); + public static boolean isBeanInstantiated = false; public void postConstruct() { - LOGGER.info("Student Bean is initialized"); + isBeanInstantiated = true; } } diff --git a/spring-core-3/src/test/java/com/baeldung/ioccontainer/IOCContainerAppUnitTest.java b/spring-core-3/src/test/java/com/baeldung/ioccontainer/IOCContainerAppUnitTest.java index 66b6842d0f..3c0a5b3dbe 100644 --- a/spring-core-3/src/test/java/com/baeldung/ioccontainer/IOCContainerAppUnitTest.java +++ b/spring-core-3/src/test/java/com/baeldung/ioccontainer/IOCContainerAppUnitTest.java @@ -3,12 +3,6 @@ package com.baeldung.ioccontainer; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -import java.util.ArrayList; -import java.util.List; - -import org.apache.log4j.AppenderSkeleton; -import org.apache.log4j.Logger; -import org.apache.log4j.spi.LoggingEvent; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -26,49 +20,37 @@ import com.baeldung.ioccontainer.bean.Student; public class IOCContainerAppUnitTest { - private LogAppender logAppender; - private List loggingEvents; - @BeforeEach - public void initializeLogAppender() { - logAppender = new LogAppender(); - Logger.getRootLogger() - .addAppender(logAppender); - loggingEvents = logAppender.events; - } - @AfterEach - public void removeLogAppender() { - Logger.getRootLogger() - .removeAppender(logAppender); + public void resetInstantiationFlag() { + Student.isBeanInstantiated = false; + CustomBeanPostProcessor.isBeanInstantiated = false; + CustomBeanFactoryPostProcessor.isBeanInstantiated = false; } @Test - public void whenBFInitialized_thenNoStudentLogPrinted() { + public void whenBFInitialized_thenStudentNotInitialized() { Resource res = new ClassPathResource("ioc-container-difference-example.xml"); BeanFactory factory = new XmlBeanFactory(res); - - String expected = "Student Bean is initialized"; - assertFalse(checkWhetherLoggerContains(expected)); + + assertFalse(Student.isBeanInstantiated); } @Test - public void whenBFInitialized_thenStudentLogPrinted() { - + public void whenBFInitialized_thenStudentInitialized() { + Resource res = new ClassPathResource("ioc-container-difference-example.xml"); BeanFactory factory = new XmlBeanFactory(res); Student student = (Student) factory.getBean("student"); - - String expected = "Student Bean is initialized"; - assertTrue(checkWhetherLoggerContains(expected)); + + assertTrue(Student.isBeanInstantiated); } - + @Test - public void whenAppContInitialized_thenStudentObjInitialized() { + public void whenAppContInitialized_thenStudentInitialized() { ApplicationContext context = new ClassPathXmlApplicationContext("ioc-container-difference-example.xml"); - - String expected = "Student Bean is initialized"; - assertTrue(checkWhetherLoggerContains(expected)); + + assertTrue(Student.isBeanInstantiated); } @Test @@ -76,22 +58,16 @@ public class IOCContainerAppUnitTest { Resource res = new ClassPathResource("ioc-container-difference-example.xml"); ConfigurableListableBeanFactory factory = new XmlBeanFactory(res); - String beanFactoryPostProcessorExpectedLog = "BeanFactoryPostProcessor is Registered"; - assertFalse(checkWhetherLoggerContains(beanFactoryPostProcessorExpectedLog)); - - String beanPostProcessorExpectedLog = "BeanPostProcessor is Registered Before Initialization"; - assertFalse(checkWhetherLoggerContains(beanPostProcessorExpectedLog)); + assertFalse(CustomBeanFactoryPostProcessor.isBeanInstantiated); + assertFalse(CustomBeanPostProcessor.isBeanInstantiated); } @Test public void whenAppContInitialized_thenBFPostProcessorAndBPostProcessorRegisteredAutomatically() { ApplicationContext context = new ClassPathXmlApplicationContext("ioc-container-difference-example.xml"); - String beanFactoryPostProcessorExpectedLog = "BeanFactoryPostProcessor is Registered"; - assertTrue(checkWhetherLoggerContains(beanFactoryPostProcessorExpectedLog)); - - String beanPostProcessorExpectedLog = "BeanPostProcessor is Registered Before Initialization"; - assertTrue(checkWhetherLoggerContains(beanPostProcessorExpectedLog)); + assertTrue(CustomBeanFactoryPostProcessor.isBeanInstantiated); + assertTrue(CustomBeanPostProcessor.isBeanInstantiated); } @Test @@ -101,37 +77,12 @@ public class IOCContainerAppUnitTest { CustomBeanFactoryPostProcessor beanFactoryPostProcessor = new CustomBeanFactoryPostProcessor(); beanFactoryPostProcessor.postProcessBeanFactory(factory); - String beanFactoryPostProcessorExpectedLog = "BeanFactoryPostProcessor is Registered"; - assertTrue(checkWhetherLoggerContains(beanFactoryPostProcessorExpectedLog)); + assertTrue(CustomBeanFactoryPostProcessor.isBeanInstantiated); CustomBeanPostProcessor beanPostProcessor = new CustomBeanPostProcessor(); factory.addBeanPostProcessor(beanPostProcessor); Student student = (Student) factory.getBean("student"); - String beanPostProcessorExpectedLog = "BeanPostProcessor is Registered Before Initialization"; - assertTrue(checkWhetherLoggerContains(beanPostProcessorExpectedLog)); + assertTrue(CustomBeanPostProcessor.isBeanInstantiated); } - private boolean checkWhetherLoggerContains(String expectedLogMessge) { - boolean isLogExist = loggingEvents.stream() - .anyMatch(logEvent -> logEvent.getMessage() - .equals(expectedLogMessge)); - return isLogExist; - } - - public static class LogAppender extends AppenderSkeleton { - public List events = new ArrayList(); - - public void close() { - } - - public boolean requiresLayout() { - return false; - } - - @Override - protected void append(LoggingEvent event) { - events.add(event); - } - - } } From cd23dbda280c7bd07a639c6d1d96151261633713 Mon Sep 17 00:00:00 2001 From: Vikas Ramsingh Rajput Date: Wed, 18 Mar 2020 20:53:30 +0300 Subject: [PATCH 04/16] BAEL-3832: Removed log4j dependency from the pom.xml and formatted the configuration xml file --- spring-core-3/pom.xml | 6 ------ .../src/test/resources/ioc-container-difference-example.xml | 3 +-- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/spring-core-3/pom.xml b/spring-core-3/pom.xml index d1163a174c..3bde25f561 100644 --- a/spring-core-3/pom.xml +++ b/spring-core-3/pom.xml @@ -68,11 +68,6 @@ test - - log4j - log4j - ${log4j.version} - @@ -89,7 +84,6 @@ 2.22.1 1.3.2 2.2.2.RELEASE - 1.2.17 \ No newline at end of file diff --git a/spring-core-3/src/test/resources/ioc-container-difference-example.xml b/spring-core-3/src/test/resources/ioc-container-difference-example.xml index 9bb01efe66..ba84aa635d 100644 --- a/spring-core-3/src/test/resources/ioc-container-difference-example.xml +++ b/spring-core-3/src/test/resources/ioc-container-difference-example.xml @@ -5,7 +5,6 @@ http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"> - - + \ No newline at end of file From f82ce12686f40e896106fb3bc3f0367ed6de386b Mon Sep 17 00:00:00 2001 From: Vikas Ramsingh Rajput Date: Wed, 18 Mar 2020 20:56:04 +0300 Subject: [PATCH 05/16] BAEL-3832: removed unnecessary line from pom.xml --- spring-core-3/pom.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/spring-core-3/pom.xml b/spring-core-3/pom.xml index 3bde25f561..205259e8e4 100644 --- a/spring-core-3/pom.xml +++ b/spring-core-3/pom.xml @@ -67,7 +67,6 @@ ${junit-jupiter.version} test - From cf216b69d6b04da2e98d16fd0b35a6e4de915ca2 Mon Sep 17 00:00:00 2001 From: Vikas Ramsingh Rajput Date: Fri, 20 Mar 2020 11:58:47 +0300 Subject: [PATCH 06/16] BAEL-3832: added setters and getters and changed the testcases accordingly --- .../bean/CustomBeanFactoryPostProcessor.java | 15 +++++--- .../bean/CustomBeanPostProcessor.java | 15 +++++--- .../baeldung/ioccontainer/bean/Student.java | 12 +++++-- .../ioccontainer/IOCContainerAppUnitTest.java | 36 +++++++++---------- 4 files changed, 49 insertions(+), 29 deletions(-) diff --git a/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/CustomBeanFactoryPostProcessor.java b/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/CustomBeanFactoryPostProcessor.java index fe773ce2df..65e249b15b 100644 --- a/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/CustomBeanFactoryPostProcessor.java +++ b/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/CustomBeanFactoryPostProcessor.java @@ -1,14 +1,21 @@ package com.baeldung.ioccontainer.bean; -import org.springframework.beans.BeansException; import org.springframework.beans.factory.config.BeanFactoryPostProcessor; import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; public class CustomBeanFactoryPostProcessor implements BeanFactoryPostProcessor { - public static boolean isBeanInstantiated = false; + private static boolean isBeanFactoryPostProcessorRegistered = false; @Override - public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { - isBeanInstantiated = true; + public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory){ + setBeanFactoryPostProcessorRegistered(true); + } + + public static boolean isBeanFactoryPostProcessorRegistered() { + return isBeanFactoryPostProcessorRegistered; + } + + public static void setBeanFactoryPostProcessorRegistered(boolean isBeanFactoryPostProcessorRegistered) { + CustomBeanFactoryPostProcessor.isBeanFactoryPostProcessorRegistered = isBeanFactoryPostProcessorRegistered; } } diff --git a/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/CustomBeanPostProcessor.java b/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/CustomBeanPostProcessor.java index 1c2e011a6c..6f99a5f0db 100644 --- a/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/CustomBeanPostProcessor.java +++ b/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/CustomBeanPostProcessor.java @@ -1,14 +1,21 @@ package com.baeldung.ioccontainer.bean; -import org.springframework.beans.BeansException; import org.springframework.beans.factory.config.BeanPostProcessor; public class CustomBeanPostProcessor implements BeanPostProcessor { - public static boolean isBeanInstantiated = false; + private static boolean isBeanPostProcessorRegistered = false; @Override - public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { - isBeanInstantiated = true; + public Object postProcessBeforeInitialization(Object bean, String beanName){ + setBeanPostProcessorRegistered(true); return bean; } + + public static boolean isBeanPostProcessorRegistered() { + return isBeanPostProcessorRegistered; + } + + public static void setBeanPostProcessorRegistered(boolean isBeanPostProcessorRegistered) { + CustomBeanPostProcessor.isBeanPostProcessorRegistered = isBeanPostProcessorRegistered; + } } diff --git a/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/Student.java b/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/Student.java index 03e0b049ba..404f323b66 100644 --- a/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/Student.java +++ b/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/Student.java @@ -1,9 +1,17 @@ package com.baeldung.ioccontainer.bean; public class Student { - public static boolean isBeanInstantiated = false; + private static boolean isBeanInstantiated = false; public void postConstruct() { - isBeanInstantiated = true; + setBeanInstantiated(true); + } + + public static boolean isBeanInstantiated() { + return isBeanInstantiated; + } + + public static void setBeanInstantiated(boolean isBeanInstantiated) { + Student.isBeanInstantiated = isBeanInstantiated; } } diff --git a/spring-core-3/src/test/java/com/baeldung/ioccontainer/IOCContainerAppUnitTest.java b/spring-core-3/src/test/java/com/baeldung/ioccontainer/IOCContainerAppUnitTest.java index 3c0a5b3dbe..e9b491813e 100644 --- a/spring-core-3/src/test/java/com/baeldung/ioccontainer/IOCContainerAppUnitTest.java +++ b/spring-core-3/src/test/java/com/baeldung/ioccontainer/IOCContainerAppUnitTest.java @@ -23,9 +23,9 @@ public class IOCContainerAppUnitTest { @BeforeEach @AfterEach public void resetInstantiationFlag() { - Student.isBeanInstantiated = false; - CustomBeanPostProcessor.isBeanInstantiated = false; - CustomBeanFactoryPostProcessor.isBeanInstantiated = false; + Student.setBeanInstantiated(false); + CustomBeanPostProcessor.setBeanPostProcessorRegistered(false); + CustomBeanFactoryPostProcessor.setBeanFactoryPostProcessorRegistered(false); } @Test @@ -33,24 +33,23 @@ public class IOCContainerAppUnitTest { Resource res = new ClassPathResource("ioc-container-difference-example.xml"); BeanFactory factory = new XmlBeanFactory(res); - assertFalse(Student.isBeanInstantiated); + assertFalse(Student.isBeanInstantiated()); } @Test public void whenBFInitialized_thenStudentInitialized() { - Resource res = new ClassPathResource("ioc-container-difference-example.xml"); BeanFactory factory = new XmlBeanFactory(res); Student student = (Student) factory.getBean("student"); - assertTrue(Student.isBeanInstantiated); + assertTrue(Student.isBeanInstantiated()); } @Test public void whenAppContInitialized_thenStudentInitialized() { ApplicationContext context = new ClassPathXmlApplicationContext("ioc-container-difference-example.xml"); - assertTrue(Student.isBeanInstantiated); + assertTrue(Student.isBeanInstantiated()); } @Test @@ -58,16 +57,8 @@ public class IOCContainerAppUnitTest { Resource res = new ClassPathResource("ioc-container-difference-example.xml"); ConfigurableListableBeanFactory factory = new XmlBeanFactory(res); - assertFalse(CustomBeanFactoryPostProcessor.isBeanInstantiated); - assertFalse(CustomBeanPostProcessor.isBeanInstantiated); - } - - @Test - public void whenAppContInitialized_thenBFPostProcessorAndBPostProcessorRegisteredAutomatically() { - ApplicationContext context = new ClassPathXmlApplicationContext("ioc-container-difference-example.xml"); - - assertTrue(CustomBeanFactoryPostProcessor.isBeanInstantiated); - assertTrue(CustomBeanPostProcessor.isBeanInstantiated); + assertFalse(CustomBeanFactoryPostProcessor.isBeanFactoryPostProcessorRegistered()); + assertFalse(CustomBeanPostProcessor.isBeanPostProcessorRegistered()); } @Test @@ -77,12 +68,19 @@ public class IOCContainerAppUnitTest { CustomBeanFactoryPostProcessor beanFactoryPostProcessor = new CustomBeanFactoryPostProcessor(); beanFactoryPostProcessor.postProcessBeanFactory(factory); - assertTrue(CustomBeanFactoryPostProcessor.isBeanInstantiated); + assertTrue(CustomBeanFactoryPostProcessor.isBeanFactoryPostProcessorRegistered()); CustomBeanPostProcessor beanPostProcessor = new CustomBeanPostProcessor(); factory.addBeanPostProcessor(beanPostProcessor); Student student = (Student) factory.getBean("student"); - assertTrue(CustomBeanPostProcessor.isBeanInstantiated); + assertTrue(CustomBeanPostProcessor.isBeanPostProcessorRegistered()); } + + @Test + public void whenAppContInitialized_thenBFPostProcessorAndBPostProcessorRegisteredAutomatically() { + ApplicationContext context = new ClassPathXmlApplicationContext("ioc-container-difference-example.xml"); + assertTrue(CustomBeanFactoryPostProcessor.isBeanFactoryPostProcessorRegistered()); + assertTrue(CustomBeanPostProcessor.isBeanPostProcessorRegistered()); + } } From b13bb933750b70375a7f7353e8b22733efa2da13 Mon Sep 17 00:00:00 2001 From: Vikas Ramsingh Rajput Date: Sat, 21 Mar 2020 09:13:32 +0300 Subject: [PATCH 07/16] BAEL-3832: removed tab space --- .../src/test/resources/ioc-container-difference-example.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-core-3/src/test/resources/ioc-container-difference-example.xml b/spring-core-3/src/test/resources/ioc-container-difference-example.xml index ba84aa635d..e53dc11f89 100644 --- a/spring-core-3/src/test/resources/ioc-container-difference-example.xml +++ b/spring-core-3/src/test/resources/ioc-container-difference-example.xml @@ -4,7 +4,7 @@ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"> - + \ No newline at end of file From 7ad1542856206c68c8817e28b0cbe9b49196beb9 Mon Sep 17 00:00:00 2001 From: Justin Albano Date: Tue, 24 Mar 2020 19:56:27 -0400 Subject: [PATCH 08/16] BAEL-3587: Added %n new line example. --- .../java/com/baeldung/newline/AddingNewLineToString.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core-java-modules/core-java-string-operations/src/main/java/com/baeldung/newline/AddingNewLineToString.java b/core-java-modules/core-java-string-operations/src/main/java/com/baeldung/newline/AddingNewLineToString.java index f701ab2e45..45de6523f9 100644 --- a/core-java-modules/core-java-string-operations/src/main/java/com/baeldung/newline/AddingNewLineToString.java +++ b/core-java-modules/core-java-string-operations/src/main/java/com/baeldung/newline/AddingNewLineToString.java @@ -38,6 +38,11 @@ public class AddingNewLineToString { System.out.println("6. Using System.getProperty(\"line.separator\")"); rhyme = line1 + System.getProperty("line.separator") + line2; System.out.println(rhyme); + + //6. Using %n + System.out.println("7. Using %n"); + rhyme = "Humpty Dumpty sat on a wall.%nHumpty Dumpty had a great fall."; + System.out.println(rhyme); System.out.println("***HTML to rendered in a browser***"); //1. Line break for HTML using
From f239c41f5fc570c7d3db66f1b5a3c7758905cd13 Mon Sep 17 00:00:00 2001 From: Justin Albano Date: Tue, 24 Mar 2020 19:57:56 -0400 Subject: [PATCH 09/16] BAEL-3587: Corrected mis-numbering in comments. --- .../main/java/com/baeldung/newline/AddingNewLineToString.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core-java-modules/core-java-string-operations/src/main/java/com/baeldung/newline/AddingNewLineToString.java b/core-java-modules/core-java-string-operations/src/main/java/com/baeldung/newline/AddingNewLineToString.java index 45de6523f9..dd8b3a420d 100644 --- a/core-java-modules/core-java-string-operations/src/main/java/com/baeldung/newline/AddingNewLineToString.java +++ b/core-java-modules/core-java-string-operations/src/main/java/com/baeldung/newline/AddingNewLineToString.java @@ -39,7 +39,7 @@ public class AddingNewLineToString { rhyme = line1 + System.getProperty("line.separator") + line2; System.out.println(rhyme); - //6. Using %n + //7. Using %n System.out.println("7. Using %n"); rhyme = "Humpty Dumpty sat on a wall.%nHumpty Dumpty had a great fall."; System.out.println(rhyme); From b2a07b9fdf4ba1183da7dd2294432bf1a414ab9c Mon Sep 17 00:00:00 2001 From: kwoyke Date: Tue, 31 Mar 2020 08:54:14 +0200 Subject: [PATCH 10/16] BAEL-2681: Upgrade core-java-collections-set to Java 11 (#8998) * BAEL-2681: Upgrade core-java-collections-set to Java 11 * BAEL-2681: Comment out core-java-collections-set from the pom.xml --- .../core-java-collections-set/pom.xml | 16 ++++++++++++++++ core-java-modules/pom.xml | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/core-java-modules/core-java-collections-set/pom.xml b/core-java-modules/core-java-collections-set/pom.xml index 8ba1b2400d..c89ba0c091 100644 --- a/core-java-modules/core-java-collections-set/pom.xml +++ b/core-java-modules/core-java-collections-set/pom.xml @@ -34,7 +34,23 @@ + + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + ${maven.compiler.source} + ${maven.compiler.target} + + + + + + 11 + 11 4.3 2.8.5 diff --git a/core-java-modules/pom.xml b/core-java-modules/pom.xml index 5e7ffa37b9..ebdb11925b 100644 --- a/core-java-modules/pom.xml +++ b/core-java-modules/pom.xml @@ -42,7 +42,7 @@ core-java-collections-list core-java-collections-list-2 core-java-collections-list-3 - core-java-collections-set + core-java-concurrency-2 core-java-concurrency-advanced From 8c69054becc77089a9cc7d27ea7959617e440736 Mon Sep 17 00:00:00 2001 From: Amit Pandey Date: Tue, 31 Mar 2020 19:25:52 +0530 Subject: [PATCH 11/16] renamed integration test to manual test (#8934) * renamed integration test to manual test * added comments in manual test case --- ...tegrationTest.java => JGitBugManualTest.java} | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) rename jgit/src/test/java/com/baeldung/jgit/{JGitBugIntegrationTest.java => JGitBugManualTest.java} (67%) diff --git a/jgit/src/test/java/com/baeldung/jgit/JGitBugIntegrationTest.java b/jgit/src/test/java/com/baeldung/jgit/JGitBugManualTest.java similarity index 67% rename from jgit/src/test/java/com/baeldung/jgit/JGitBugIntegrationTest.java rename to jgit/src/test/java/com/baeldung/jgit/JGitBugManualTest.java index ad34890996..bcfe615bc7 100644 --- a/jgit/src/test/java/com/baeldung/jgit/JGitBugIntegrationTest.java +++ b/jgit/src/test/java/com/baeldung/jgit/JGitBugManualTest.java @@ -10,10 +10,18 @@ import org.junit.Test; import java.io.IOException; import static org.junit.Assert.assertNotNull; -/** - * Tests which show issues with JGit that we reported upstream. - */ -public class JGitBugIntegrationTest { +public class JGitBugManualTest { + + /** + * This test case expects one git repository to be present in local file system. + * Currently this test uses the Baeldung repository i.e. the current checkout repository. + * It finds the repository by tracking back and scan file system to find .git folder in + * the file system. + * + * Before running the test case ensure that the .git folder is present. + * + * @throws IOException + */ @Test public void testRevWalkDisposeClosesReader() throws IOException { try (Repository repo = Helper.openJGitRepository()) { From 1e052c5a721be544899a146080b5103f1af2c8d5 Mon Sep 17 00:00:00 2001 From: Amy DeGregorio Date: Tue, 31 Mar 2020 12:02:54 -0400 Subject: [PATCH 12/16] BAEL-3827 Add CSS and JS to Thymeleaf (#8985) * BAEL-3827 Add CSS and JS to Thymeleaf * BAEL-3827 Add integration tests * BAEL-3827 Add new spring-thymeleaf-3 module to the parent pom.xml * BAEL-3827 Add new spring-thymeleaf-3 module to the parent pom.xml in both places --- pom.xml | 2 + spring-thymeleaf-3/README.md | 5 ++ spring-thymeleaf-3/pom.xml | 78 +++++++++++++++++++ .../com/baeldung/thymeleaf/Application.java | 11 +++ .../cssandjs/CssAndJsApplication.java | 11 +++ .../cssandjs/CssAndJsController.java | 15 ++++ .../resources/static/js/cssandjs/actions.js | 7 ++ .../resources/static/styles/cssandjs/main.css | 18 +++++ .../templates/cssandjs/styledPage.html | 20 +++++ .../thymeleaf/ApplicationIntegrationTest.java | 13 ++++ .../CssAndJsControllerIntegrationTest.java | 41 ++++++++++ 11 files changed, 221 insertions(+) create mode 100644 spring-thymeleaf-3/README.md create mode 100644 spring-thymeleaf-3/pom.xml create mode 100644 spring-thymeleaf-3/src/main/java/com/baeldung/thymeleaf/Application.java create mode 100644 spring-thymeleaf-3/src/main/java/com/baeldung/thymeleaf/cssandjs/CssAndJsApplication.java create mode 100644 spring-thymeleaf-3/src/main/java/com/baeldung/thymeleaf/cssandjs/CssAndJsController.java create mode 100644 spring-thymeleaf-3/src/main/resources/static/js/cssandjs/actions.js create mode 100644 spring-thymeleaf-3/src/main/resources/static/styles/cssandjs/main.css create mode 100644 spring-thymeleaf-3/src/main/resources/templates/cssandjs/styledPage.html create mode 100644 spring-thymeleaf-3/src/test/java/com/baeldung/thymeleaf/ApplicationIntegrationTest.java create mode 100644 spring-thymeleaf-3/src/test/java/com/baeldung/thymeleaf/cssandjs/CssAndJsControllerIntegrationTest.java diff --git a/pom.xml b/pom.xml index e82390a37e..9f132ca7a8 100644 --- a/pom.xml +++ b/pom.xml @@ -729,6 +729,7 @@ spring-threads spring-thymeleaf spring-thymeleaf-2 + spring-thymeleaf-3 spring-vault spring-vertx @@ -1229,6 +1230,7 @@ spring-thymeleaf spring-thymeleaf-2 + spring-thymeleaf-3 spring-vault spring-vertx diff --git a/spring-thymeleaf-3/README.md b/spring-thymeleaf-3/README.md new file mode 100644 index 0000000000..e1ddd727d7 --- /dev/null +++ b/spring-thymeleaf-3/README.md @@ -0,0 +1,5 @@ +## Spring Thymeleaf 3 + +This module contains articles about Spring with Thymeleaf + +## Relevant Articles: \ No newline at end of file diff --git a/spring-thymeleaf-3/pom.xml b/spring-thymeleaf-3/pom.xml new file mode 100644 index 0000000000..7677e50d79 --- /dev/null +++ b/spring-thymeleaf-3/pom.xml @@ -0,0 +1,78 @@ + + + 4.0.0 + spring-thymeleaf-3 + spring-thymeleaf-3 + war + + + com.baeldung + parent-boot-2 + 0.0.1-SNAPSHOT + ../parent-boot-2 + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + com.baeldung.thymeleaf.cssandjs.CssAndJsApplication + JAR + + + + org.apache.maven.plugins + maven-war-plugin + + + + org.apache.tomcat.maven + tomcat7-maven-plugin + ${tomcat7-maven-plugin.version} + + + tomcat-run + + exec-war-only + + package + + / + false + webapp.jar + utf-8 + + + + + + spring-thymeleaf-3 + + + + 1.8 + 1.8 + 2.2 + + + diff --git a/spring-thymeleaf-3/src/main/java/com/baeldung/thymeleaf/Application.java b/spring-thymeleaf-3/src/main/java/com/baeldung/thymeleaf/Application.java new file mode 100644 index 0000000000..2ccca82497 --- /dev/null +++ b/spring-thymeleaf-3/src/main/java/com/baeldung/thymeleaf/Application.java @@ -0,0 +1,11 @@ +package com.baeldung.thymeleaf; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class Application { + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } +} diff --git a/spring-thymeleaf-3/src/main/java/com/baeldung/thymeleaf/cssandjs/CssAndJsApplication.java b/spring-thymeleaf-3/src/main/java/com/baeldung/thymeleaf/cssandjs/CssAndJsApplication.java new file mode 100644 index 0000000000..fc6c142b8b --- /dev/null +++ b/spring-thymeleaf-3/src/main/java/com/baeldung/thymeleaf/cssandjs/CssAndJsApplication.java @@ -0,0 +1,11 @@ +package com.baeldung.thymeleaf.cssandjs; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class CssAndJsApplication { + public static void main(String[] args) { + SpringApplication.run(CssAndJsApplication.class, args); + } +} diff --git a/spring-thymeleaf-3/src/main/java/com/baeldung/thymeleaf/cssandjs/CssAndJsController.java b/spring-thymeleaf-3/src/main/java/com/baeldung/thymeleaf/cssandjs/CssAndJsController.java new file mode 100644 index 0000000000..b56a7b468e --- /dev/null +++ b/spring-thymeleaf-3/src/main/java/com/baeldung/thymeleaf/cssandjs/CssAndJsController.java @@ -0,0 +1,15 @@ +package com.baeldung.thymeleaf.cssandjs; + +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.GetMapping; + +@Controller +public class CssAndJsController { + + @GetMapping("/styled-page") + public String getStyledPage(Model model) { + model.addAttribute("name", "Baeldung Reader"); + return "cssandjs/styledPage"; + } +} diff --git a/spring-thymeleaf-3/src/main/resources/static/js/cssandjs/actions.js b/spring-thymeleaf-3/src/main/resources/static/js/cssandjs/actions.js new file mode 100644 index 0000000000..e192e6358e --- /dev/null +++ b/spring-thymeleaf-3/src/main/resources/static/js/cssandjs/actions.js @@ -0,0 +1,7 @@ +function showAlert() { + alert("The button was clicked!"); +} + +function showName(name) { + alert("Here's the name: " + name); +} \ No newline at end of file diff --git a/spring-thymeleaf-3/src/main/resources/static/styles/cssandjs/main.css b/spring-thymeleaf-3/src/main/resources/static/styles/cssandjs/main.css new file mode 100644 index 0000000000..1f57b4616a --- /dev/null +++ b/spring-thymeleaf-3/src/main/resources/static/styles/cssandjs/main.css @@ -0,0 +1,18 @@ +h2 { + font-family: sans-serif; + font-size: 1.5em; + text-transform: uppercase; +} + +strong { + font-weight: 700; + background-color: yellow; +} + +p { + font-family: sans-serif; +} + +label { + font-weight: 600; +} \ No newline at end of file diff --git a/spring-thymeleaf-3/src/main/resources/templates/cssandjs/styledPage.html b/spring-thymeleaf-3/src/main/resources/templates/cssandjs/styledPage.html new file mode 100644 index 0000000000..12e4fc9227 --- /dev/null +++ b/spring-thymeleaf-3/src/main/resources/templates/cssandjs/styledPage.html @@ -0,0 +1,20 @@ + + + + + Add CSS and JS to Thymeleaf + + + + + +

Carefully Styled Heading

+

+ This is text on which we want to apply very special styling. +

+

+ + + \ No newline at end of file diff --git a/spring-thymeleaf-3/src/test/java/com/baeldung/thymeleaf/ApplicationIntegrationTest.java b/spring-thymeleaf-3/src/test/java/com/baeldung/thymeleaf/ApplicationIntegrationTest.java new file mode 100644 index 0000000000..b7cfa140f0 --- /dev/null +++ b/spring-thymeleaf-3/src/test/java/com/baeldung/thymeleaf/ApplicationIntegrationTest.java @@ -0,0 +1,13 @@ +package com.baeldung.thymeleaf; + +import org.junit.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +public class ApplicationIntegrationTest { + + @Test + public void contextLoads() { + + } +} diff --git a/spring-thymeleaf-3/src/test/java/com/baeldung/thymeleaf/cssandjs/CssAndJsControllerIntegrationTest.java b/spring-thymeleaf-3/src/test/java/com/baeldung/thymeleaf/cssandjs/CssAndJsControllerIntegrationTest.java new file mode 100644 index 0000000000..365608bd2a --- /dev/null +++ b/spring-thymeleaf-3/src/test/java/com/baeldung/thymeleaf/cssandjs/CssAndJsControllerIntegrationTest.java @@ -0,0 +1,41 @@ +package com.baeldung.thymeleaf.cssandjs; + +import static org.hamcrest.CoreMatchers.containsString; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.view; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; +import org.springframework.test.web.servlet.setup.MockMvcBuilders; +import org.springframework.web.context.WebApplicationContext; + +@RunWith(SpringJUnit4ClassRunner.class) +@WebAppConfiguration +@ContextConfiguration(classes = CssAndJsApplication.class) +public class CssAndJsControllerIntegrationTest { + @Autowired + private WebApplicationContext context; + + private MockMvc mockMvc; + + @Before + public void setup() { + this.mockMvc = MockMvcBuilders.webAppContextSetup(this.context).build(); + } + + @Test + public void whenCalledGetStyledPage_thenReturnContent() throws Exception { + this.mockMvc.perform(MockMvcRequestBuilders.get("/styled-page")) + .andExpect(status().isOk()) + .andExpect(view().name("cssandjs/styledPage")) + .andExpect(content().string(containsString("Carefully Styled Heading"))); + } +} From dc5f7efe47ca47050a4e6f5a0534a0fd1bb870be Mon Sep 17 00:00:00 2001 From: Ali Dehghani Date: Tue, 31 Mar 2020 22:04:57 +0430 Subject: [PATCH 13/16] Fixing the False Sharing of the Data.sql File --- .../main/resources/application-lazy-load-no-trans-off.properties | 1 + .../main/resources/application-lazy-load-no-trans-on.properties | 1 + .../src/main/resources/{data.sql => data-trans.sql} | 0 3 files changed, 2 insertions(+) rename persistence-modules/spring-boot-persistence-h2/src/main/resources/{data.sql => data-trans.sql} (100%) diff --git a/persistence-modules/spring-boot-persistence-h2/src/main/resources/application-lazy-load-no-trans-off.properties b/persistence-modules/spring-boot-persistence-h2/src/main/resources/application-lazy-load-no-trans-off.properties index b5fb841685..1055806ecf 100644 --- a/persistence-modules/spring-boot-persistence-h2/src/main/resources/application-lazy-load-no-trans-off.properties +++ b/persistence-modules/spring-boot-persistence-h2/src/main/resources/application-lazy-load-no-trans-off.properties @@ -5,6 +5,7 @@ spring.datasource.password= spring.jpa.hibernate.ddl-auto=create-drop spring.h2.console.enabled=true spring.h2.console.path=/h2-console +spring.datasource.data=data-trans.sql logging.level.org.hibernate.SQL=INFO logging.level.org.hibernate.type=TRACE diff --git a/persistence-modules/spring-boot-persistence-h2/src/main/resources/application-lazy-load-no-trans-on.properties b/persistence-modules/spring-boot-persistence-h2/src/main/resources/application-lazy-load-no-trans-on.properties index 04579e1dae..77aacf0d77 100644 --- a/persistence-modules/spring-boot-persistence-h2/src/main/resources/application-lazy-load-no-trans-on.properties +++ b/persistence-modules/spring-boot-persistence-h2/src/main/resources/application-lazy-load-no-trans-on.properties @@ -5,6 +5,7 @@ spring.datasource.password= spring.jpa.hibernate.ddl-auto=create-drop spring.h2.console.enabled=true spring.h2.console.path=/h2-console +spring.datasource.data=data-trans.sql logging.level.org.hibernate.SQL=INFO logging.level.org.hibernate.type=TRACE diff --git a/persistence-modules/spring-boot-persistence-h2/src/main/resources/data.sql b/persistence-modules/spring-boot-persistence-h2/src/main/resources/data-trans.sql similarity index 100% rename from persistence-modules/spring-boot-persistence-h2/src/main/resources/data.sql rename to persistence-modules/spring-boot-persistence-h2/src/main/resources/data-trans.sql From 408d19ffe96953c96a551e143d4f8f412617ae5c Mon Sep 17 00:00:00 2001 From: Krzysztof Woyke Date: Wed, 1 Apr 2020 09:35:52 +0200 Subject: [PATCH 14/16] BAEL-3181: Add bytebuddy dependency --- spring-5-mvc/pom.xml | 7 ++++++- spring-5-mvc/src/main/resources/application.properties | 3 --- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/spring-5-mvc/pom.xml b/spring-5-mvc/pom.xml index 2f8ef05bff..4b42528d0f 100644 --- a/spring-5-mvc/pom.xml +++ b/spring-5-mvc/pom.xml @@ -42,6 +42,11 @@ org.slf4j jcl-over-slf4j + + net.bytebuddy + byte-buddy + ${byte-buddy.version} + org.jetbrains.kotlin @@ -175,8 +180,8 @@ 2.9.0 2.9.9 1.2.71 - com.baeldung.Spring5Application 4.5.8 + com.baeldung.Spring5Application diff --git a/spring-5-mvc/src/main/resources/application.properties b/spring-5-mvc/src/main/resources/application.properties index 886ea1978b..ccec014c2b 100644 --- a/spring-5-mvc/src/main/resources/application.properties +++ b/spring-5-mvc/src/main/resources/application.properties @@ -1,6 +1,3 @@ server.port=8081 -security.user.name=user -security.user.password=pass - logging.level.root=INFO \ No newline at end of file From b56b71cf5f223ec31965844d5601ab319aa3ba2b Mon Sep 17 00:00:00 2001 From: kwoyke Date: Wed, 1 Apr 2020 20:42:54 +0200 Subject: [PATCH 15/16] BAEL-2682: Move java-immutable-set article to core-java-collections-set module (#9001) --- core-java-modules/core-java-9/README.md | 1 - core-java-modules/core-java-collections-set/README.md | 1 + .../src/main/java/com/baeldung}/set/UnmodifiableSet.java | 2 +- .../src/test/java/com/baeldung/set}/SetExamplesUnitTest.java | 5 +++-- 4 files changed, 5 insertions(+), 4 deletions(-) rename core-java-modules/{core-java-9/src/main/java/com/baeldung/java9 => core-java-collections-set/src/main/java/com/baeldung}/set/UnmodifiableSet.java (97%) rename core-java-modules/{core-java-9/src/test/java/com/baeldung/java9 => core-java-collections-set/src/test/java/com/baeldung/set}/SetExamplesUnitTest.java (97%) diff --git a/core-java-modules/core-java-9/README.md b/core-java-modules/core-java-9/README.md index 2dbf159750..0a9bf76ac4 100644 --- a/core-java-modules/core-java-9/README.md +++ b/core-java-modules/core-java-9/README.md @@ -8,5 +8,4 @@ This module contains articles about Java 9 core features - [Introduction to Chronicle Queue](https://www.baeldung.com/java-chronicle-queue) - [Iterate Through a Range of Dates in Java](https://www.baeldung.com/java-iterate-date-range) - [Initialize a HashMap in Java](https://www.baeldung.com/java-initialize-hashmap) -- [Immutable Set in Java](https://www.baeldung.com/java-immutable-set) - [Immutable ArrayList in Java](https://www.baeldung.com/java-immutable-list) diff --git a/core-java-modules/core-java-collections-set/README.md b/core-java-modules/core-java-collections-set/README.md index 2b34ef3449..b97cd3216f 100644 --- a/core-java-modules/core-java-collections-set/README.md +++ b/core-java-modules/core-java-collections-set/README.md @@ -11,3 +11,4 @@ This module contains articles about the Java Set collection - [Guide to EnumSet](https://www.baeldung.com/java-enumset) - [Set Operations in Java](https://www.baeldung.com/java-set-operations) - [Copying Sets in Java](https://www.baeldung.com/java-copy-sets) +- [Immutable Set in Java](https://www.baeldung.com/java-immutable-set) diff --git a/core-java-modules/core-java-9/src/main/java/com/baeldung/java9/set/UnmodifiableSet.java b/core-java-modules/core-java-collections-set/src/main/java/com/baeldung/set/UnmodifiableSet.java similarity index 97% rename from core-java-modules/core-java-9/src/main/java/com/baeldung/java9/set/UnmodifiableSet.java rename to core-java-modules/core-java-collections-set/src/main/java/com/baeldung/set/UnmodifiableSet.java index 7dbcd2a3a3..2af040b13e 100644 --- a/core-java-modules/core-java-9/src/main/java/com/baeldung/java9/set/UnmodifiableSet.java +++ b/core-java-modules/core-java-collections-set/src/main/java/com/baeldung/set/UnmodifiableSet.java @@ -1,4 +1,4 @@ -package com.baeldung.java9.set; +package com.baeldung.set; import com.google.common.collect.ImmutableSet; diff --git a/core-java-modules/core-java-9/src/test/java/com/baeldung/java9/SetExamplesUnitTest.java b/core-java-modules/core-java-collections-set/src/test/java/com/baeldung/set/SetExamplesUnitTest.java similarity index 97% rename from core-java-modules/core-java-9/src/test/java/com/baeldung/java9/SetExamplesUnitTest.java rename to core-java-modules/core-java-collections-set/src/test/java/com/baeldung/set/SetExamplesUnitTest.java index 28e71affcc..d89927dfd6 100644 --- a/core-java-modules/core-java-9/src/test/java/com/baeldung/java9/SetExamplesUnitTest.java +++ b/core-java-modules/core-java-collections-set/src/test/java/com/baeldung/set/SetExamplesUnitTest.java @@ -1,9 +1,10 @@ -package com.baeldung.java9; +package com.baeldung.set; + +import org.junit.Test; import java.util.Collections; import java.util.HashSet; import java.util.Set; -import org.junit.Test; import static org.junit.Assert.assertEquals; From b4610e110f34e6a394640928fa52da8efdd22827 Mon Sep 17 00:00:00 2001 From: Kumar Chandrakant Date: Thu, 2 Apr 2020 00:23:38 +0530 Subject: [PATCH 16/16] Adding code for article tracked under BAEL-3573. (#8999) Co-authored-by: CHANDRAKANT Kumar --- .../core-java-concurrency-testing/.gitignore | 26 ++++++ .../core-java-concurrency-testing/README.md | 7 ++ .../core-java-concurrency-testing/pom.xml | 93 +++++++++++++++++++ .../com/baeldung/concurrent/MyCounter.java | 22 +++++ .../src/main/resources/logback.xml | 19 ++++ .../concurrent/MyCounterJCStressUnitTest.java | 36 +++++++ .../MyCounterMultithreadedTCUnitTest.java | 35 +++++++ .../concurrent/MyCounterSimpleUnitTest.java | 57 ++++++++++++ .../MyCounterTempusFugitUnitTest.java | 35 +++++++ .../MyCounterThreadWeaverUnitTest.java | 42 +++++++++ .../src/test/resources/.gitignore | 13 +++ 11 files changed, 385 insertions(+) create mode 100644 core-java-modules/core-java-concurrency-testing/.gitignore create mode 100644 core-java-modules/core-java-concurrency-testing/README.md create mode 100644 core-java-modules/core-java-concurrency-testing/pom.xml create mode 100644 core-java-modules/core-java-concurrency-testing/src/main/java/com/baeldung/concurrent/MyCounter.java create mode 100644 core-java-modules/core-java-concurrency-testing/src/main/resources/logback.xml create mode 100644 core-java-modules/core-java-concurrency-testing/src/test/java/com/baeldung/concurrent/MyCounterJCStressUnitTest.java create mode 100644 core-java-modules/core-java-concurrency-testing/src/test/java/com/baeldung/concurrent/MyCounterMultithreadedTCUnitTest.java create mode 100644 core-java-modules/core-java-concurrency-testing/src/test/java/com/baeldung/concurrent/MyCounterSimpleUnitTest.java create mode 100644 core-java-modules/core-java-concurrency-testing/src/test/java/com/baeldung/concurrent/MyCounterTempusFugitUnitTest.java create mode 100644 core-java-modules/core-java-concurrency-testing/src/test/java/com/baeldung/concurrent/MyCounterThreadWeaverUnitTest.java create mode 100644 core-java-modules/core-java-concurrency-testing/src/test/resources/.gitignore diff --git a/core-java-modules/core-java-concurrency-testing/.gitignore b/core-java-modules/core-java-concurrency-testing/.gitignore new file mode 100644 index 0000000000..3de4cc647e --- /dev/null +++ b/core-java-modules/core-java-concurrency-testing/.gitignore @@ -0,0 +1,26 @@ +*.class + +0.* + +#folders# +/target +/neoDb* +/data +/src/main/webapp/WEB-INF/classes +*/META-INF/* +.resourceCache + +# Packaged files # +*.jar +*.war +*.ear + +# Files generated by integration tests +*.txt +backup-pom.xml +/bin/ +/temp + +#IntelliJ specific +.idea/ +*.iml \ No newline at end of file diff --git a/core-java-modules/core-java-concurrency-testing/README.md b/core-java-modules/core-java-concurrency-testing/README.md new file mode 100644 index 0000000000..fef74a6750 --- /dev/null +++ b/core-java-modules/core-java-concurrency-testing/README.md @@ -0,0 +1,7 @@ +========= + +## Core Java Concurrency Testing Examples + +### Relevant Articles: +- [Testing Multi-Threaded Code in Java](https://www.baeldung.com/java-testing-multithreaded) + diff --git a/core-java-modules/core-java-concurrency-testing/pom.xml b/core-java-modules/core-java-concurrency-testing/pom.xml new file mode 100644 index 0000000000..bb3e6f5152 --- /dev/null +++ b/core-java-modules/core-java-concurrency-testing/pom.xml @@ -0,0 +1,93 @@ + + + 4.0.0 + core-java-concurrency-testing + 0.1.0-SNAPSHOT + core-java-concurrency-testing + jar + + + com.baeldung + parent-java + 0.0.1-SNAPSHOT + ../../parent-java + + + + + junit + junit + 4.13 + test + + + com.googlecode.thread-weaver + threadweaver + 0.2 + test + + + com.google.code.tempus-fugit + tempus-fugit + 1.1 + test + + + com.googlecode.multithreadedtc + multithreadedtc + 1.01 + test + + + org.openjdk.jcstress + jcstress-core + 0.5 + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + ${javac.target} + ${javac.target} + ${javac.target} + + + + + org.apache.maven.plugins + maven-shade-plugin + 2.2 + + + main + package + + shade + + + jcstress + + + org.openjdk.jcstress.Main + + + META-INF/TestList + + + + + + + + + + diff --git a/core-java-modules/core-java-concurrency-testing/src/main/java/com/baeldung/concurrent/MyCounter.java b/core-java-modules/core-java-concurrency-testing/src/main/java/com/baeldung/concurrent/MyCounter.java new file mode 100644 index 0000000000..a678b047a8 --- /dev/null +++ b/core-java-modules/core-java-concurrency-testing/src/main/java/com/baeldung/concurrent/MyCounter.java @@ -0,0 +1,22 @@ +package com.baeldung.concurrent; + +public class MyCounter { + + private int count; + + public void increment() { + int temp = count; + count = temp + 1; + } + + public synchronized void incrementWithWait() throws InterruptedException { + int temp = count; + wait(100); + count = temp + 1; + } + + public int getCount() { + return count; + } + +} diff --git a/core-java-modules/core-java-concurrency-testing/src/main/resources/logback.xml b/core-java-modules/core-java-concurrency-testing/src/main/resources/logback.xml new file mode 100644 index 0000000000..56af2d397e --- /dev/null +++ b/core-java-modules/core-java-concurrency-testing/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/core-java-modules/core-java-concurrency-testing/src/test/java/com/baeldung/concurrent/MyCounterJCStressUnitTest.java b/core-java-modules/core-java-concurrency-testing/src/test/java/com/baeldung/concurrent/MyCounterJCStressUnitTest.java new file mode 100644 index 0000000000..6c76505347 --- /dev/null +++ b/core-java-modules/core-java-concurrency-testing/src/test/java/com/baeldung/concurrent/MyCounterJCStressUnitTest.java @@ -0,0 +1,36 @@ +package com.baeldung.concurrent; + +import static org.openjdk.jcstress.annotations.Expect.ACCEPTABLE; +import static org.openjdk.jcstress.annotations.Expect.ACCEPTABLE_INTERESTING; + +import org.openjdk.jcstress.annotations.Actor; +import org.openjdk.jcstress.annotations.Arbiter; +import org.openjdk.jcstress.annotations.JCStressTest; +import org.openjdk.jcstress.annotations.Outcome; +import org.openjdk.jcstress.annotations.State; +import org.openjdk.jcstress.infra.results.I_Result; + +@JCStressTest +@Outcome(id = "1", expect = ACCEPTABLE_INTERESTING, desc = "One update lost.") +@Outcome(id = "2", expect = ACCEPTABLE, desc = "Both updates.") +@State +public class MyCounterJCStressUnitTest { + + private MyCounter counter; + + @Actor + public void actor1() { + counter.increment(); + } + + @Actor + public void actor2() { + counter.increment(); + } + + @Arbiter + public void arbiter(I_Result r) { + r.r1 = counter.getCount(); + } + +} diff --git a/core-java-modules/core-java-concurrency-testing/src/test/java/com/baeldung/concurrent/MyCounterMultithreadedTCUnitTest.java b/core-java-modules/core-java-concurrency-testing/src/test/java/com/baeldung/concurrent/MyCounterMultithreadedTCUnitTest.java new file mode 100644 index 0000000000..eb4e77cae9 --- /dev/null +++ b/core-java-modules/core-java-concurrency-testing/src/test/java/com/baeldung/concurrent/MyCounterMultithreadedTCUnitTest.java @@ -0,0 +1,35 @@ +package com.baeldung.concurrent; + +import org.junit.Test; + +import edu.umd.cs.mtc.MultithreadedTestCase; +import edu.umd.cs.mtc.TestFramework; + +public class MyCounterMultithreadedTCUnitTest extends MultithreadedTestCase { + + private MyCounter counter; + + @Override + public void initialize() { + counter = new MyCounter(); + } + + public void thread1() throws InterruptedException { + counter.increment(); + } + + public void thread2() throws InterruptedException { + counter.increment(); + } + + @SuppressWarnings("deprecation") + @Override + public void finish() { + assertEquals(2, counter.getCount()); + } + + @Test + public void testCounter() throws Throwable { + TestFramework.runManyTimes(new MyCounterMultithreadedTCUnitTest(), 1000); + } +} diff --git a/core-java-modules/core-java-concurrency-testing/src/test/java/com/baeldung/concurrent/MyCounterSimpleUnitTest.java b/core-java-modules/core-java-concurrency-testing/src/test/java/com/baeldung/concurrent/MyCounterSimpleUnitTest.java new file mode 100644 index 0000000000..4f3409b923 --- /dev/null +++ b/core-java-modules/core-java-concurrency-testing/src/test/java/com/baeldung/concurrent/MyCounterSimpleUnitTest.java @@ -0,0 +1,57 @@ +package com.baeldung.concurrent; + +import static org.junit.Assert.assertEquals; + +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +import org.junit.Test; + +public class MyCounterSimpleUnitTest { + + @Test + public void testCounter() { + MyCounter counter = new MyCounter(); + for (int i = 0; i < 500; i++) + counter.increment(); + assertEquals(500, counter.getCount()); + } + + // @Test + public void testCounterWithConcurrency() throws InterruptedException { + int numberOfThreads = 100; + ExecutorService service = Executors.newFixedThreadPool(10); + CountDownLatch latch = new CountDownLatch(numberOfThreads); + MyCounter counter = new MyCounter(); + for (int i = 0; i < numberOfThreads; i++) { + service.execute(() -> { + counter.increment(); + latch.countDown(); + }); + } + latch.await(); + assertEquals(numberOfThreads, counter.getCount()); + } + + // @Test + public void testSummationWithConcurrencyAndWait() throws InterruptedException { + int numberOfThreads = 2; + ExecutorService service = Executors.newFixedThreadPool(10); + CountDownLatch latch = new CountDownLatch(numberOfThreads); + MyCounter counter = new MyCounter(); + for (int i = 0; i < numberOfThreads; i++) { + service.submit(() -> { + try { + counter.incrementWithWait(); + } catch (InterruptedException e) { + e.printStackTrace(); + } + latch.countDown(); + }); + } + latch.await(); + assertEquals(numberOfThreads, counter.getCount()); + } + +} diff --git a/core-java-modules/core-java-concurrency-testing/src/test/java/com/baeldung/concurrent/MyCounterTempusFugitUnitTest.java b/core-java-modules/core-java-concurrency-testing/src/test/java/com/baeldung/concurrent/MyCounterTempusFugitUnitTest.java new file mode 100644 index 0000000000..360c61b4f4 --- /dev/null +++ b/core-java-modules/core-java-concurrency-testing/src/test/java/com/baeldung/concurrent/MyCounterTempusFugitUnitTest.java @@ -0,0 +1,35 @@ +package com.baeldung.concurrent; + +import static org.junit.Assert.assertEquals; + +import org.junit.AfterClass; +import org.junit.Rule; +import org.junit.Test; + +import com.google.code.tempusfugit.concurrency.ConcurrentRule; +import com.google.code.tempusfugit.concurrency.RepeatingRule; +import com.google.code.tempusfugit.concurrency.annotations.Concurrent; +import com.google.code.tempusfugit.concurrency.annotations.Repeating; + +public class MyCounterTempusFugitUnitTest { + + @Rule + public ConcurrentRule concurrently = new ConcurrentRule(); + @Rule + public RepeatingRule rule = new RepeatingRule(); + + private static MyCounter counter = new MyCounter(); + + @Test + @Concurrent(count = 2) + @Repeating(repetition = 10) + public void runsMultipleTimes() { + counter.increment(); + } + + @AfterClass + public static void annotatedTestRunsMultipleTimes() throws InterruptedException { + assertEquals(counter.getCount(), 20); + } + +} diff --git a/core-java-modules/core-java-concurrency-testing/src/test/java/com/baeldung/concurrent/MyCounterThreadWeaverUnitTest.java b/core-java-modules/core-java-concurrency-testing/src/test/java/com/baeldung/concurrent/MyCounterThreadWeaverUnitTest.java new file mode 100644 index 0000000000..29b08996cd --- /dev/null +++ b/core-java-modules/core-java-concurrency-testing/src/test/java/com/baeldung/concurrent/MyCounterThreadWeaverUnitTest.java @@ -0,0 +1,42 @@ +package com.baeldung.concurrent; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + +import com.google.testing.threadtester.AnnotatedTestRunner; +import com.google.testing.threadtester.ThreadedAfter; +import com.google.testing.threadtester.ThreadedBefore; +import com.google.testing.threadtester.ThreadedMain; +import com.google.testing.threadtester.ThreadedSecondary; + +public class MyCounterThreadWeaverUnitTest { + + private MyCounter counter; + + @ThreadedBefore + public void before() { + counter = new MyCounter(); + } + + @ThreadedMain + public void mainThread() { + counter.increment(); + } + + @ThreadedSecondary + public void secondThread() { + counter.increment(); + } + + @ThreadedAfter + public void after() { + assertEquals(2, counter.getCount()); + } + + @Test + public void testCounter() { + new AnnotatedTestRunner().runTests(this.getClass(), MyCounter.class); + } + +} \ No newline at end of file diff --git a/core-java-modules/core-java-concurrency-testing/src/test/resources/.gitignore b/core-java-modules/core-java-concurrency-testing/src/test/resources/.gitignore new file mode 100644 index 0000000000..83c05e60c8 --- /dev/null +++ b/core-java-modules/core-java-concurrency-testing/src/test/resources/.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