diff --git a/spring-boot/.gitignore b/spring-boot/.gitignore
index 24d64373c4..e26d6af438 100644
--- a/spring-boot/.gitignore
+++ b/spring-boot/.gitignore
@@ -1 +1,4 @@
/target/
+.settings/
+.classpath
+.project
diff --git a/spring-boot/pom.xml b/spring-boot/pom.xml
index d0a66197bf..368dfa19c1 100644
--- a/spring-boot/pom.xml
+++ b/spring-boot/pom.xml
@@ -1,4 +1,5 @@
-
+
4.0.0
com.baeldung
spring-boot
@@ -11,15 +12,29 @@
org.springframework.boot
spring-boot-starter-parent
- 1.3.3.RELEASE
+ 1.3.6.RELEASE
+
+
+
+ org.baeldung.boot.DemoApplication
+ UTF-8
+ 1.8
+
+
+
org.springframework.boot
spring-boot-starter-web
+
+ org.springframework.boot
+ spring-boot-starter-data-jpa
+
+
org.springframework.boot
spring-boot-starter-actuator
@@ -34,6 +49,17 @@
io.dropwizard.metrics
metrics-core
+
+
+ com.h2database
+ h2
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
@@ -70,4 +96,4 @@
-
\ No newline at end of file
+
diff --git a/spring-boot/src/main/java/org/baeldung/boot/DemoApplication.java b/spring-boot/src/main/java/org/baeldung/boot/DemoApplication.java
new file mode 100644
index 0000000000..e61d140396
--- /dev/null
+++ b/spring-boot/src/main/java/org/baeldung/boot/DemoApplication.java
@@ -0,0 +1,14 @@
+package org.baeldung.boot;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class DemoApplication {
+
+ public static void main(String[] args) {
+ System.setProperty("spring.config.name", "demo");
+ SpringApplication.run(DemoApplication.class, args);
+ }
+
+}
diff --git a/spring-boot/src/main/java/org/baeldung/boot/model/Foo.java b/spring-boot/src/main/java/org/baeldung/boot/model/Foo.java
new file mode 100644
index 0000000000..6a36459e3c
--- /dev/null
+++ b/spring-boot/src/main/java/org/baeldung/boot/model/Foo.java
@@ -0,0 +1,39 @@
+package org.baeldung.boot.model;
+
+import java.io.Serializable;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+
+@Entity
+public class Foo implements Serializable {
+ private static final long serialVersionUID = 1L;
+ @Id
+ @GeneratedValue
+ private Integer id;
+ private String name;
+
+ public Foo() {
+ }
+
+ public Foo(String name) {
+ this.name = name;
+ }
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
diff --git a/spring-boot/src/main/java/org/baeldung/boot/repository/FooRepository.java b/spring-boot/src/main/java/org/baeldung/boot/repository/FooRepository.java
new file mode 100644
index 0000000000..09d6975dba
--- /dev/null
+++ b/spring-boot/src/main/java/org/baeldung/boot/repository/FooRepository.java
@@ -0,0 +1,8 @@
+package org.baeldung.boot.repository;
+
+import org.baeldung.boot.model.Foo;
+import org.springframework.data.jpa.repository.JpaRepository;
+
+public interface FooRepository extends JpaRepository {
+ public Foo findByName(String name);
+}
diff --git a/spring-boot/src/main/resources/demo.properties b/spring-boot/src/main/resources/demo.properties
new file mode 100644
index 0000000000..649b64f59b
--- /dev/null
+++ b/spring-boot/src/main/resources/demo.properties
@@ -0,0 +1,6 @@
+spring.output.ansi.enabled=never
+server.port=7070
+
+# Security
+security.user.name=admin
+security.user.password=password
\ No newline at end of file
diff --git a/spring-boot/src/test/java/org/baeldung/boot/DemoApplicationTests.java b/spring-boot/src/test/java/org/baeldung/boot/DemoApplicationTests.java
new file mode 100644
index 0000000000..41c5a545cc
--- /dev/null
+++ b/spring-boot/src/test/java/org/baeldung/boot/DemoApplicationTests.java
@@ -0,0 +1,17 @@
+package org.baeldung.boot;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.SpringApplicationConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.web.WebAppConfiguration;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@SpringApplicationConfiguration(classes = DemoApplication.class)
+@WebAppConfiguration
+public class DemoApplicationTests {
+
+ @Test
+ public void contextLoads() {
+ }
+}
diff --git a/spring-boot/src/test/java/org/baeldung/boot/repository/FooRepositoryTest.java b/spring-boot/src/test/java/org/baeldung/boot/repository/FooRepositoryTest.java
new file mode 100644
index 0000000000..9de7790a75
--- /dev/null
+++ b/spring-boot/src/test/java/org/baeldung/boot/repository/FooRepositoryTest.java
@@ -0,0 +1,34 @@
+package org.baeldung.boot.repository;
+
+import static org.junit.Assert.assertThat;
+
+import org.baeldung.boot.DemoApplicationTests;
+import org.baeldung.boot.model.Foo;
+
+import static org.hamcrest.Matchers.notNullValue;
+import static org.hamcrest.Matchers.is;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+
+@Transactional
+public class FooRepositoryTest extends DemoApplicationTests {
+ @Autowired
+ private FooRepository fooRepository;
+
+ @Before
+ public void setUp() {
+ fooRepository.save(new Foo("Foo"));
+ fooRepository.save(new Foo("Bar"));
+ }
+
+ @Test
+ public void testFindByName() {
+ Foo foo = fooRepository.findByName("Bar");
+ assertThat(foo, notNullValue());
+ assertThat(foo.getId(), is(2));
+ }
+
+}