diff --git a/pom.xml b/pom.xml index 02f4e720c0..196870800c 100644 --- a/pom.xml +++ b/pom.xml @@ -594,6 +594,7 @@ tensorflow-java spf4j + spring-boot-configuration spring-boot-flowable spring-boot-mvc-2 spring-boot-performance @@ -681,6 +682,7 @@ spring-boot-bootstrap spring-boot-camel + spring-boot-configuration spring-boot-client spring-boot-crud diff --git a/spring-boot-configuration/README.md b/spring-boot-configuration/README.md new file mode 100644 index 0000000000..c449538a9d --- /dev/null +++ b/spring-boot-configuration/README.md @@ -0,0 +1,5 @@ +# Spring Boot Configuration + +This module contains articles about Spring Boot Configuration. + +### Relevant Articles: diff --git a/spring-boot-configuration/data-jpa-application/pom.xml b/spring-boot-configuration/data-jpa-application/pom.xml new file mode 100644 index 0000000000..b1bf6fda43 --- /dev/null +++ b/spring-boot-configuration/data-jpa-application/pom.xml @@ -0,0 +1,12 @@ + + 4.0.0 + data-jpa-application + 0.0.1-SNAPSHOT + + + com.baeldung.spring-boot-configuration + spring-boot-configuration + 0.0.1-SNAPSHOT + + \ No newline at end of file diff --git a/spring-boot-configuration/data-jpa-application/src/main/java/com/baeldung/data/jpa/ApplicationFound.java b/spring-boot-configuration/data-jpa-application/src/main/java/com/baeldung/data/jpa/ApplicationFound.java new file mode 100644 index 0000000000..50efb42a19 --- /dev/null +++ b/spring-boot-configuration/data-jpa-application/src/main/java/com/baeldung/data/jpa/ApplicationFound.java @@ -0,0 +1,7 @@ +package com.baeldung.data.jpa; + +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class ApplicationFound { +} diff --git a/spring-boot-configuration/data-jpa-application/src/main/java/com/baeldung/data/jpa/application/ApplicationNotFound.java b/spring-boot-configuration/data-jpa-application/src/main/java/com/baeldung/data/jpa/application/ApplicationNotFound.java new file mode 100644 index 0000000000..8e7362f626 --- /dev/null +++ b/spring-boot-configuration/data-jpa-application/src/main/java/com/baeldung/data/jpa/application/ApplicationNotFound.java @@ -0,0 +1,7 @@ +package com.baeldung.data.jpa.application; + +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class ApplicationNotFound { +} diff --git a/spring-boot-configuration/data-jpa-application/src/test/java/com/baeldung/data/jpa/DataJpaUnitTest.java b/spring-boot-configuration/data-jpa-application/src/test/java/com/baeldung/data/jpa/DataJpaUnitTest.java new file mode 100644 index 0000000000..ac7ff8561b --- /dev/null +++ b/spring-boot-configuration/data-jpa-application/src/test/java/com/baeldung/data/jpa/DataJpaUnitTest.java @@ -0,0 +1,23 @@ +package com.baeldung.data.jpa; + +import static org.junit.Assert.assertNotNull; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; +import org.springframework.boot.test.autoconfigure.orm.jpa.TestEntityManager; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@DataJpaTest +public class DataJpaUnitTest { + + @Autowired + private TestEntityManager entityManager; + + @Test + public void givenACorrectSetup_thenAnEntityManagerWillBeAvailable() { + assertNotNull(entityManager); + } +} diff --git a/spring-boot-configuration/data-jpa-library/pom.xml b/spring-boot-configuration/data-jpa-library/pom.xml new file mode 100644 index 0000000000..1534e7ed23 --- /dev/null +++ b/spring-boot-configuration/data-jpa-library/pom.xml @@ -0,0 +1,12 @@ + + 4.0.0 + data-jpa-library + 0.0.1-SNAPSHOT + + + com.baeldung.spring-boot-configuration + spring-boot-configuration + 0.0.1-SNAPSHOT + + \ No newline at end of file diff --git a/spring-boot-configuration/data-jpa-library/src/main/java/com/baeldung/data/jpa/libarary/model/Example.java b/spring-boot-configuration/data-jpa-library/src/main/java/com/baeldung/data/jpa/libarary/model/Example.java new file mode 100644 index 0000000000..d5c41d303e --- /dev/null +++ b/spring-boot-configuration/data-jpa-library/src/main/java/com/baeldung/data/jpa/libarary/model/Example.java @@ -0,0 +1,13 @@ +package com.baeldung.data.jpa.libarary.model; + +public class Example { + private String example; + + public String getExample() { + return example; + } + + public void setExample(String example) { + this.example = example; + } +} diff --git a/spring-boot-configuration/data-jpa-library/src/test/java/com/baeldung/data/jpa/TestApplication.java b/spring-boot-configuration/data-jpa-library/src/test/java/com/baeldung/data/jpa/TestApplication.java new file mode 100644 index 0000000000..83f60b388b --- /dev/null +++ b/spring-boot-configuration/data-jpa-library/src/test/java/com/baeldung/data/jpa/TestApplication.java @@ -0,0 +1,7 @@ +package com.baeldung.data.jpa; + +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class TestApplication { +} diff --git a/spring-boot-configuration/data-jpa-library/src/test/java/com/baeldung/data/jpa/libarary/DataJpaUnitTest.java b/spring-boot-configuration/data-jpa-library/src/test/java/com/baeldung/data/jpa/libarary/DataJpaUnitTest.java new file mode 100644 index 0000000000..31f12a6093 --- /dev/null +++ b/spring-boot-configuration/data-jpa-library/src/test/java/com/baeldung/data/jpa/libarary/DataJpaUnitTest.java @@ -0,0 +1,24 @@ +package com.baeldung.data.jpa.libarary; + +import static org.junit.Assert.assertNotNull; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; +import org.springframework.boot.test.autoconfigure.orm.jpa.TestEntityManager; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@DataJpaTest +public class DataJpaUnitTest { + + @Autowired + private TestEntityManager entityManager; + + @Test + public void givenACorrectSetup_thenAnEntityManagerWillBeAvailable() { + assertNotNull(entityManager); + } + +} diff --git a/spring-boot-configuration/pom.xml b/spring-boot-configuration/pom.xml new file mode 100644 index 0000000000..e4473c3f2d --- /dev/null +++ b/spring-boot-configuration/pom.xml @@ -0,0 +1,61 @@ + + 4.0.0 + com.baeldung.spring-boot-configuration + spring-boot-configuration + 0.0.1-SNAPSHOT + pom + + + com.baeldung + parent-boot-2 + 0.0.1-SNAPSHOT + ../parent-boot-2/pom.xml + + + + data-jpa-library + data-jpa-application + + + + + + org.springframework.boot + spring-boot-dependencies + ${spring-boot.version} + pom + import + + + + + + + org.springframework.boot + spring-boot-starter-data-jpa + ${spring-boot.version} + + + + org.springframework.boot + spring-boot-starter-test + ${spring-boot.version} + test + + + + com.h2database + h2 + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + \ No newline at end of file diff --git a/spring-boot-exceptions/README.md b/spring-boot-exceptions/README.md deleted file mode 100644 index bbc272aec4..0000000000 --- a/spring-boot-exceptions/README.md +++ /dev/null @@ -1,4 +0,0 @@ - -### Relevant Articles: - -- [Rendering Exceptions in JSON with Spring](https://www.baeldung.com/spring-exceptions-json)