mappingConflicts = appServlet.addMapping("/");
+ if (!mappingConflicts.isEmpty()) {
+ throw new IllegalStateException("'appServlet' could not be mapped to '/' due " + "to an existing mapping. This is a known issue under Tomcat versions " + "<= 7.0.14; see https://issues.apache.org/bugzilla/show_bug.cgi?id=51278");
+ }
+ }
+
+}
diff --git a/spring-mvc-velocity/src/main/java/com/baeldung/mvc/velocity/spring/config/WebConfig.java b/spring-mvc-velocity/src/main/java/com/baeldung/mvc/velocity/spring/config/WebConfig.java
new file mode 100644
index 0000000000..ce8ce1919a
--- /dev/null
+++ b/spring-mvc-velocity/src/main/java/com/baeldung/mvc/velocity/spring/config/WebConfig.java
@@ -0,0 +1,45 @@
+package com.baeldung.mvc.velocity.spring.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.servlet.ViewResolver;
+import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer;
+import org.springframework.web.servlet.config.annotation.EnableWebMvc;
+import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
+import org.springframework.web.servlet.view.velocity.VelocityConfigurer;
+import org.springframework.web.servlet.view.velocity.VelocityLayoutViewResolver;
+
+@Configuration
+@EnableWebMvc
+@ComponentScan(basePackages = { "com.baeldung.mvc.velocity.controller", "com.baeldung.mvc.velocity.service"})
+public class WebConfig extends WebMvcConfigurerAdapter {
+
+ @Override
+ public void addResourceHandlers(ResourceHandlerRegistry registry) {
+ registry.addResourceHandler("/resources/**").addResourceLocations("/resources/");
+ }
+
+ @Override
+ public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
+ configurer.enable();
+ }
+
+ @Bean
+ public ViewResolver viewResolver() {
+ final VelocityLayoutViewResolver bean = new VelocityLayoutViewResolver();
+ bean.setCache(true);
+ bean.setPrefix("/WEB-INF/views/");
+ bean.setLayoutUrl("/WEB-INF/layouts/layout.vm");
+ bean.setSuffix(".vm");
+ return bean;
+ }
+
+ @Bean
+ public VelocityConfigurer velocityConfig() {
+ VelocityConfigurer velocityConfigurer = new VelocityConfigurer();
+ velocityConfigurer.setResourceLoaderPath("/");
+ return velocityConfigurer;
+ }
+}
diff --git a/spring-mvc-velocity/src/main/webapp/WEB-INF/fragments/footer.vm b/spring-mvc-velocity/src/main/webapp/WEB-INF/fragments/footer.vm
new file mode 100644
index 0000000000..41bb36ce5e
--- /dev/null
+++ b/spring-mvc-velocity/src/main/webapp/WEB-INF/fragments/footer.vm
@@ -0,0 +1,4 @@
+
+ @Copyright baeldung.com
+
\ No newline at end of file
diff --git a/spring-mvc-velocity/src/main/webapp/WEB-INF/fragments/header.vm b/spring-mvc-velocity/src/main/webapp/WEB-INF/fragments/header.vm
new file mode 100644
index 0000000000..8fffa6cdab
--- /dev/null
+++ b/spring-mvc-velocity/src/main/webapp/WEB-INF/fragments/header.vm
@@ -0,0 +1,5 @@
+
\ No newline at end of file
diff --git a/spring-mvc-velocity/src/main/webapp/WEB-INF/layouts/layout.vm b/spring-mvc-velocity/src/main/webapp/WEB-INF/layouts/layout.vm
new file mode 100644
index 0000000000..3bac96aaae
--- /dev/null
+++ b/spring-mvc-velocity/src/main/webapp/WEB-INF/layouts/layout.vm
@@ -0,0 +1,22 @@
+
+
+ Spring with Velocity
+
+
+
+ #parse("/WEB-INF/fragments/header.vm")
+
+
+
+
+
+
+ $screen_content
+
+
+
+
+ #parse("/WEB-INF/fragments/footer.vm")
+
+
+
\ No newline at end of file
diff --git a/spring-mvc-velocity/src/main/webapp/WEB-INF/mvc-servlet.xml b/spring-mvc-velocity/src/main/webapp/WEB-INF/mvc-servlet.xml
new file mode 100644
index 0000000000..8b4fd570fe
--- /dev/null
+++ b/spring-mvc-velocity/src/main/webapp/WEB-INF/mvc-servlet.xml
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ /
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-mvc-velocity/src/main/webapp/WEB-INF/spring-context.xml b/spring-mvc-velocity/src/main/webapp/WEB-INF/spring-context.xml
new file mode 100644
index 0000000000..2f3b0f19bb
--- /dev/null
+++ b/spring-mvc-velocity/src/main/webapp/WEB-INF/spring-context.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-mvc-velocity/src/main/webapp/WEB-INF/views/index.vm b/spring-mvc-velocity/src/main/webapp/WEB-INF/views/index.vm
new file mode 100644
index 0000000000..8883a50658
--- /dev/null
+++ b/spring-mvc-velocity/src/main/webapp/WEB-INF/views/index.vm
@@ -0,0 +1,4 @@
+Index
+
+Welcome page
+This is just the welcome page
\ No newline at end of file
diff --git a/spring-mvc-velocity/src/main/webapp/WEB-INF/views/list.vm b/spring-mvc-velocity/src/main/webapp/WEB-INF/views/list.vm
new file mode 100644
index 0000000000..9e06a09e4f
--- /dev/null
+++ b/spring-mvc-velocity/src/main/webapp/WEB-INF/views/list.vm
@@ -0,0 +1,19 @@
+Index
+
+Tutorials list
+
+
+ Tutorial Id |
+ Tutorial Title |
+ Tutorial Description |
+ Tutorial Author |
+
+#foreach($tut in $tutorials)
+
+ $tut.tutId |
+ $tut.title |
+ $tut.description |
+ $tut.author |
+
+#end
+
\ No newline at end of file
diff --git a/spring-mvc-velocity/src/main/webapp/WEB-INF/web_old.xml b/spring-mvc-velocity/src/main/webapp/WEB-INF/web_old.xml
new file mode 100644
index 0000000000..72050c0d37
--- /dev/null
+++ b/spring-mvc-velocity/src/main/webapp/WEB-INF/web_old.xml
@@ -0,0 +1,32 @@
+
+
+
+ Spring MVC Velocity
+
+
+ mvc
+ org.springframework.web.servlet.DispatcherServlet
+
+ contextConfigLocation
+ /WEB-INF/mvc-servlet.xml
+
+ 1
+
+
+
+ mvc
+ /*
+
+
+
+ contextConfigLocation
+ /WEB-INF/spring-context.xml
+
+
+
+ org.springframework.web.context.ContextLoaderListener
+
+
\ No newline at end of file
diff --git a/spring-mvc-velocity/src/test/java/com/baeldung/mvc/velocity/test/DataContentControllerTest.java b/spring-mvc-velocity/src/test/java/com/baeldung/mvc/velocity/test/DataContentControllerTest.java
new file mode 100644
index 0000000000..a9fb242755
--- /dev/null
+++ b/spring-mvc-velocity/src/test/java/com/baeldung/mvc/velocity/test/DataContentControllerTest.java
@@ -0,0 +1,61 @@
+package com.baeldung.mvc.velocity.test;
+
+import static org.hamcrest.Matchers.allOf;
+import static org.hamcrest.Matchers.hasItem;
+import static org.hamcrest.Matchers.hasProperty;
+import static org.hamcrest.Matchers.hasSize;
+import static org.hamcrest.Matchers.is;
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.model;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.view;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.xpath;
+
+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.setup.MockMvcBuilders;
+import org.springframework.web.context.WebApplicationContext;
+
+import com.baeldung.mvc.velocity.spring.config.WebConfig;
+import com.baeldung.mvc.velocity.test.config.TestConfig;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+// @ContextConfiguration(locations = {"classpath:mvc-servlet.xml"})
+@ContextConfiguration(classes = { TestConfig.class, WebConfig.class })
+@WebAppConfiguration
+public class DataContentControllerTest {
+
+ private MockMvc mockMvc;
+
+ @Autowired
+ private WebApplicationContext webApplicationContext;
+
+ @Before
+ public void setUp() {
+
+
+ mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).build();
+ }
+
+ @Test
+ public void whenCallingList_ThenModelAndContentOK() throws Exception {
+
+ mockMvc.perform(get("/list")).andExpect(status().isOk()).andExpect(view().name("list")).andExpect(model().attribute("tutorials", hasSize(2)))
+ .andExpect(model().attribute("tutorials", hasItem(allOf(hasProperty("tutId", is(1)), hasProperty("author", is("GuavaAuthor")), hasProperty("title", is("Guava"))))))
+ .andExpect(model().attribute("tutorials", hasItem(allOf(hasProperty("tutId", is(2)), hasProperty("author", is("AndroidAuthor")), hasProperty("title", is("Android"))))));
+
+ mockMvc.perform(get("/list")).andExpect(xpath("//table").exists());
+ mockMvc.perform(get("/list")).andExpect(xpath("//td[@id='tutId_1']").exists());
+ }
+
+ @Test
+ public void whenCallingIndex_thenViewOK() throws Exception{
+ mockMvc.perform(get("/")).andExpect(status().isOk()).andExpect(view().name("index")).andExpect(model().size(0));
+ }
+}
diff --git a/spring-mvc-velocity/src/test/java/com/baeldung/mvc/velocity/test/config/TestConfig.java b/spring-mvc-velocity/src/test/java/com/baeldung/mvc/velocity/test/config/TestConfig.java
new file mode 100644
index 0000000000..8b84bcdd23
--- /dev/null
+++ b/spring-mvc-velocity/src/test/java/com/baeldung/mvc/velocity/test/config/TestConfig.java
@@ -0,0 +1,32 @@
+package com.baeldung.mvc.velocity.test.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.servlet.ViewResolver;
+import org.springframework.web.servlet.view.velocity.VelocityConfigurer;
+import org.springframework.web.servlet.view.velocity.VelocityLayoutViewResolver;
+
+@Configuration
+public class TestConfig {
+
+
+ @Bean
+ public ViewResolver viewResolver() {
+ final VelocityLayoutViewResolver bean = new VelocityLayoutViewResolver();
+ bean.setCache(true);
+ bean.setPrefix("/WEB-INF/views/");
+ bean.setLayoutUrl("/WEB-INF/layouts/layout.vm");
+ bean.setSuffix(".vm");
+ return bean;
+ }
+
+ @Bean
+ public VelocityConfigurer velocityConfig() {
+ VelocityConfigurer velocityConfigurer = new VelocityConfigurer();
+ velocityConfigurer.setResourceLoaderPath("/");
+ return velocityConfigurer;
+ }
+
+
+
+}
diff --git a/spring-mvc-velocity/src/test/resources/mvc-servlet.xml b/spring-mvc-velocity/src/test/resources/mvc-servlet.xml
new file mode 100644
index 0000000000..8b4fd570fe
--- /dev/null
+++ b/spring-mvc-velocity/src/test/resources/mvc-servlet.xml
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ /
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-openid/.classpath b/spring-openid/.classpath
deleted file mode 100644
index 0cad5db2d0..0000000000
--- a/spring-openid/.classpath
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/spring-openid/.project b/spring-openid/.project
deleted file mode 100644
index 81874eb896..0000000000
--- a/spring-openid/.project
+++ /dev/null
@@ -1,48 +0,0 @@
-
-
- spring-openid
-
-
-
-
-
- org.eclipse.wst.jsdt.core.javascriptValidator
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
- org.eclipse.wst.common.project.facet.core.builder
-
-
-
-
- org.springframework.ide.eclipse.core.springbuilder
-
-
-
-
- org.eclipse.wst.validation.validationbuilder
-
-
-
-
- org.eclipse.m2e.core.maven2Builder
-
-
-
-
-
- org.eclipse.jem.workbench.JavaEMFNature
- org.eclipse.wst.common.modulecore.ModuleCoreNature
- org.springframework.ide.eclipse.core.springnature
- org.eclipse.jdt.core.javanature
- org.eclipse.m2e.core.maven2Nature
- org.eclipse.wst.common.project.facet.core.nature
- org.eclipse.wst.jsdt.core.jsNature
-
-
diff --git a/spring-quartz/.classpath b/spring-quartz/.classpath
deleted file mode 100644
index 6d7587a819..0000000000
--- a/spring-quartz/.classpath
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/spring-quartz/.project b/spring-quartz/.project
deleted file mode 100644
index 6adc420837..0000000000
--- a/spring-quartz/.project
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
- spring-quartz
-
-
-
-
-
- org.eclipse.wst.common.project.facet.core.builder
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
- org.eclipse.m2e.core.maven2Builder
-
-
-
-
- org.springframework.ide.eclipse.core.springbuilder
-
-
-
-
-
- org.springframework.ide.eclipse.core.springnature
- org.eclipse.jdt.core.javanature
- org.eclipse.m2e.core.maven2Nature
- org.eclipse.wst.common.project.facet.core.nature
-
-
diff --git a/spring-rest-angular-pagination/StudentDirectory/pom.xml b/spring-rest-angular-pagination/StudentDirectory/pom.xml
new file mode 100644
index 0000000000..8dab851ef2
--- /dev/null
+++ b/spring-rest-angular-pagination/StudentDirectory/pom.xml
@@ -0,0 +1,86 @@
+
+
+ 4.0.0
+ angular-spring-rest-sample
+ angular-spring-rest-sample
+ com.baeldung
+ 1.0
+ war
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 1.3.3.RELEASE
+
+
+ 1.12.2.RELEASE
+
+
+
+ org.springframework.boot
+ spring-boot-starter-tomcat
+ provided
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+ org.springframework.data
+ spring-data-commons
+
+
+ org.springframework
+ spring-test
+ test
+
+
+ org.apache.commons
+ commons-lang3
+ 3.3
+
+
+ com.google.guava
+ guava
+ 19.0
+
+
+ junit
+ junit
+ test
+
+
+ io.rest-assured
+ rest-assured
+ 3.0.0
+ test
+
+
+ io.rest-assured
+ spring-mock-mvc
+ 3.0.0
+ test
+
+
+
+ angular-spring-rest-sample
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+
+ 1.8
+
+
+
+ org.apache.maven.plugins
+ maven-war-plugin
+
+ false
+
+
+
+
+
diff --git a/spring-rest-angular-pagination/StudentDirectory/src/main/java/org/baeldung/mock/MockStudentData.java b/spring-rest-angular-pagination/StudentDirectory/src/main/java/org/baeldung/mock/MockStudentData.java
new file mode 100644
index 0000000000..df70780a87
--- /dev/null
+++ b/spring-rest-angular-pagination/StudentDirectory/src/main/java/org/baeldung/mock/MockStudentData.java
@@ -0,0 +1,39 @@
+package org.baeldung.mock;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.baeldung.web.vo.Student;
+
+public class MockStudentData {
+
+ private static List studentList = new ArrayList<>();
+
+ static {
+ studentList.add(new Student("1", "Bryan", "Male", 20));
+ studentList.add(new Student("2", "Ben", "Male", 22));
+ studentList.add(new Student("3", "Lisa", "Female", 24));
+ studentList.add(new Student("4", "Sarah", "Female", 26));
+ studentList.add(new Student("5", "Jay", "Male", 20));
+ studentList.add(new Student("6", "John", "Male", 22));
+ studentList.add(new Student("7", "Jordan", "Male", 24));
+ studentList.add(new Student("8", "Rob", "Male", 26));
+ studentList.add(new Student("9", "Will", "Male", 20));
+ studentList.add(new Student("10", "Shawn", "Male", 22));
+ studentList.add(new Student("11", "Taylor", "Female", 24));
+ studentList.add(new Student("12", "Venus", "Female", 26));
+ studentList.add(new Student("13", "Vince", "Male", 20));
+ studentList.add(new Student("14", "Carol", "Female", 22));
+ studentList.add(new Student("15", "Joana", "Female", 24));
+ studentList.add(new Student("16", "Dion", "Male", 26));
+ studentList.add(new Student("17", "Evans", "Male", 20));
+ studentList.add(new Student("18", "Bart", "Male", 22));
+ studentList.add(new Student("19", "Jenny", "Female", 24));
+ studentList.add(new Student("20", "Kristine", "Female", 26));
+ }
+
+ public static List getMockDataStudents(){
+ return studentList;
+ }
+
+}
diff --git a/spring-rest-angular-pagination/StudentDirectory/src/main/java/org/baeldung/web/exception/MyResourceNotFoundException.java b/spring-rest-angular-pagination/StudentDirectory/src/main/java/org/baeldung/web/exception/MyResourceNotFoundException.java
new file mode 100644
index 0000000000..3105d1cb11
--- /dev/null
+++ b/spring-rest-angular-pagination/StudentDirectory/src/main/java/org/baeldung/web/exception/MyResourceNotFoundException.java
@@ -0,0 +1,27 @@
+package org.baeldung.web.exception;
+
+public class MyResourceNotFoundException extends RuntimeException {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 4088649120307193208L;
+
+ public MyResourceNotFoundException() {
+ super();
+ }
+
+ public MyResourceNotFoundException(final String message, final Throwable cause) {
+ super(message, cause);
+ }
+
+ public MyResourceNotFoundException(final String message) {
+ super(message);
+ }
+
+ public MyResourceNotFoundException(final Throwable cause) {
+ super(cause);
+ }
+
+
+}
diff --git a/spring-rest-angular-pagination/StudentDirectory/src/main/java/org/baeldung/web/main/Application.java b/spring-rest-angular-pagination/StudentDirectory/src/main/java/org/baeldung/web/main/Application.java
new file mode 100644
index 0000000000..b3b0dad98a
--- /dev/null
+++ b/spring-rest-angular-pagination/StudentDirectory/src/main/java/org/baeldung/web/main/Application.java
@@ -0,0 +1,26 @@
+package org.baeldung.web.main;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.web.filter.ShallowEtagHeaderFilter;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
+
+@SpringBootApplication
+@EnableAutoConfiguration
+@ComponentScan("org.baeldung")
+public class Application extends WebMvcConfigurerAdapter {
+
+
+ public static void main(String[] args) {
+ SpringApplication.run(Application.class, args);
+ }
+
+ @Bean
+ public ShallowEtagHeaderFilter shallowEtagHeaderFilter() {
+ return new ShallowEtagHeaderFilter();
+ }
+
+}
diff --git a/spring-rest-angular-pagination/StudentDirectory/src/main/java/org/baeldung/web/rest/StudentDirectoryRestController.java b/spring-rest-angular-pagination/StudentDirectory/src/main/java/org/baeldung/web/rest/StudentDirectoryRestController.java
new file mode 100644
index 0000000000..5ff24ec0f2
--- /dev/null
+++ b/spring-rest-angular-pagination/StudentDirectory/src/main/java/org/baeldung/web/rest/StudentDirectoryRestController.java
@@ -0,0 +1,26 @@
+package org.baeldung.web.rest;
+
+import org.baeldung.web.service.StudentService;
+import org.baeldung.web.vo.Student;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+public class StudentDirectoryRestController {
+
+ @Autowired
+ private StudentService service;
+
+ @RequestMapping(value = "/student/get", params = { "page", "size" }, method = RequestMethod.GET)
+ public Page findPaginated(@RequestParam("page") int page, @RequestParam("size") int size){
+
+ Page resultPage = service.findPaginated(page, size);
+
+ return resultPage;
+ }
+
+}
diff --git a/spring-rest-angular-pagination/StudentDirectory/src/main/java/org/baeldung/web/service/IOperations.java b/spring-rest-angular-pagination/StudentDirectory/src/main/java/org/baeldung/web/service/IOperations.java
new file mode 100644
index 0000000000..0b408106ce
--- /dev/null
+++ b/spring-rest-angular-pagination/StudentDirectory/src/main/java/org/baeldung/web/service/IOperations.java
@@ -0,0 +1,9 @@
+package org.baeldung.web.service;
+
+import org.springframework.data.domain.Page;
+
+public interface IOperations {
+
+ Page findPaginated(int page, int size);
+
+}
diff --git a/spring-rest-angular-pagination/StudentDirectory/src/main/java/org/baeldung/web/service/StudentService.java b/spring-rest-angular-pagination/StudentDirectory/src/main/java/org/baeldung/web/service/StudentService.java
new file mode 100644
index 0000000000..5c4487254a
--- /dev/null
+++ b/spring-rest-angular-pagination/StudentDirectory/src/main/java/org/baeldung/web/service/StudentService.java
@@ -0,0 +1,7 @@
+package org.baeldung.web.service;
+
+import org.baeldung.web.vo.Student;
+
+public interface StudentService extends IOperations{
+
+}
diff --git a/spring-rest-angular-pagination/StudentDirectory/src/main/java/org/baeldung/web/service/StudentServiceImpl.java b/spring-rest-angular-pagination/StudentDirectory/src/main/java/org/baeldung/web/service/StudentServiceImpl.java
new file mode 100644
index 0000000000..3b6dda6fb1
--- /dev/null
+++ b/spring-rest-angular-pagination/StudentDirectory/src/main/java/org/baeldung/web/service/StudentServiceImpl.java
@@ -0,0 +1,36 @@
+package org.baeldung.web.service;
+
+import java.util.List;
+
+import org.baeldung.mock.MockStudentData;
+import org.baeldung.web.exception.MyResourceNotFoundException;
+import org.baeldung.web.vo.Student;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.PageImpl;
+import org.springframework.data.domain.PageRequest;
+import org.springframework.stereotype.Service;
+
+@Service
+public class StudentServiceImpl implements StudentService {
+
+ private List mockDataStudent = MockStudentData.getMockDataStudents();
+
+ @Override
+ public Page findPaginated(int page, int size){
+ Page studentPage = getPage(page, size);
+ return studentPage;
+ }
+
+ private Page getPage(int page, int size) {
+ page = page != 0?page - 1:page;
+ int from = Math.max(0, page * size);
+ int to = Math.min(mockDataStudent.size(), (page + 1) * size);
+ if(from > to){
+ throw new MyResourceNotFoundException("page number is higher than total pages.");
+ }
+ return new PageImpl(mockDataStudent.subList(from, to),
+ new PageRequest(page,size),
+ mockDataStudent.size());
+ }
+
+}
diff --git a/spring-rest-angular-pagination/StudentDirectory/src/main/java/org/baeldung/web/vo/Student.java b/spring-rest-angular-pagination/StudentDirectory/src/main/java/org/baeldung/web/vo/Student.java
new file mode 100644
index 0000000000..11c503815d
--- /dev/null
+++ b/spring-rest-angular-pagination/StudentDirectory/src/main/java/org/baeldung/web/vo/Student.java
@@ -0,0 +1,60 @@
+package org.baeldung.web.vo;
+
+import java.io.Serializable;
+
+public class Student implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ public Student() {
+ }
+
+ public Student(String studentId, String name, String gender, Integer age) {
+ super();
+ this.studentId = studentId;
+ this.name = name;
+ this.gender = gender;
+ this.age = age;
+ }
+
+ private String studentId;
+ private String name;
+ private String gender;
+ private Integer age;
+
+ public String getStudentId() {
+ return studentId;
+ }
+
+ public void setStudentId(String studentId) {
+ this.studentId = studentId;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getGender() {
+ return gender;
+ }
+
+ public void setGender(String gender) {
+ this.gender = gender;
+ }
+
+ public Integer getAge() {
+ return age;
+ }
+
+ public void setAge(Integer age) {
+ this.age = age;
+ }
+
+}
diff --git a/spring-rest-angular-pagination/StudentDirectory/src/main/resources/application.properties b/spring-rest-angular-pagination/StudentDirectory/src/main/resources/application.properties
new file mode 100644
index 0000000000..a9bf6ca218
--- /dev/null
+++ b/spring-rest-angular-pagination/StudentDirectory/src/main/resources/application.properties
@@ -0,0 +1 @@
+server.contextPath=/StudentDirectory
\ No newline at end of file
diff --git a/spring-rest-angular-pagination/StudentDirectory/src/main/webapp/WEB-INF/web.xml b/spring-rest-angular-pagination/StudentDirectory/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000000..ff65bd6b96
--- /dev/null
+++ b/spring-rest-angular-pagination/StudentDirectory/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,11 @@
+
+
+
+
+ index.html
+
+
+
\ No newline at end of file
diff --git a/spring-rest-angular-pagination/StudentDirectory/src/main/webapp/index.html b/spring-rest-angular-pagination/StudentDirectory/src/main/webapp/index.html
new file mode 100644
index 0000000000..56a1273588
--- /dev/null
+++ b/spring-rest-angular-pagination/StudentDirectory/src/main/webapp/index.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-rest-angular-pagination/StudentDirectory/src/main/webapp/view/app.js b/spring-rest-angular-pagination/StudentDirectory/src/main/webapp/view/app.js
new file mode 100644
index 0000000000..522c49c8cb
--- /dev/null
+++ b/spring-rest-angular-pagination/StudentDirectory/src/main/webapp/view/app.js
@@ -0,0 +1,54 @@
+var app = angular.module('app', ['ui.grid','ui.grid.pagination']);
+
+app.controller('StudentCtrl', ['$scope','StudentService', function ($scope,StudentService) {
+ var paginationOptions = {
+ pageNumber: 1,
+ pageSize: 5,
+ sort: null
+ };
+
+ StudentService.getStudents(paginationOptions.pageNumber,
+ paginationOptions.pageSize).success(function(data){
+ $scope.gridOptions.data = data.content;
+ $scope.gridOptions.totalItems = data.totalElements;
+ });
+
+ $scope.gridOptions = {
+ paginationPageSizes: [5, 10, 20],
+ paginationPageSize: paginationOptions.pageSize,
+ enableColumnMenus:false,
+ columnDefs: [
+ { name: 'studentId' },
+ { name: 'name' },
+ { name: 'gender' },
+ { name: 'age' }
+ ],
+ onRegisterApi: function(gridApi) {
+ $scope.gridApi = gridApi;
+ gridApi.pagination.on.paginationChanged($scope, function (newPage, pageSize) {
+ paginationOptions.pageNumber = newPage;
+ paginationOptions.pageSize = pageSize;
+ StudentService.getStudents(newPage,pageSize).success(function(data){
+ $scope.gridOptions.data = data.content;
+ $scope.gridOptions.totalItems = data.totalElements;
+ });
+ });
+ }
+ };
+
+}]);
+
+app.service('StudentService',['$http', function ($http) {
+
+ function getStudents(pageNumber,size) {
+ return $http({
+ method: 'GET',
+ url: 'student/get?page='+pageNumber+'&size='+size
+ });
+ }
+
+ return {
+ getStudents:getStudents
+ };
+
+}]);
\ No newline at end of file
diff --git a/spring-rest-angular-pagination/StudentDirectory/src/test/java/org/baeldung/web/service/StudentServiceTest.java b/spring-rest-angular-pagination/StudentDirectory/src/test/java/org/baeldung/web/service/StudentServiceTest.java
new file mode 100644
index 0000000000..3e476bf0d0
--- /dev/null
+++ b/spring-rest-angular-pagination/StudentDirectory/src/test/java/org/baeldung/web/service/StudentServiceTest.java
@@ -0,0 +1,49 @@
+package org.baeldung.web.service;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.commons.lang3.RandomStringUtils;
+import org.baeldung.web.main.Application;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.IntegrationTest;
+import org.springframework.boot.test.SpringApplicationConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.web.WebAppConfiguration;
+
+import io.restassured.RestAssured;
+import io.restassured.response.Response;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@SpringApplicationConfiguration(classes = Application.class)
+@WebAppConfiguration
+@IntegrationTest("server.port:8080")
+public class StudentServiceTest{
+
+ private String getURL() {
+ return "/StudentDirectory/student/get";
+ }
+
+ @Test
+ public void whenResourcesAreRetrievedPaged_then200IsReceived(){
+ Response response = RestAssured.given().get(getURL()+ "?page=0&size=2").andReturn();
+
+ assertTrue(response.getStatusCode() == 200 );
+ }
+
+ @Test
+ public void whenPageOfResourcesAreRetrievedOutOfBounds_then404IsReceived(){
+ String url = getURL()+ "?page=" + RandomStringUtils.randomNumeric(5) + "&size=2";
+ Response response = RestAssured.given().get(url);
+
+ assertTrue(response.getStatusCode() == 500 );
+ }
+
+ @Test
+ public void givenResourcesExist_whenFirstPageIsRetrieved_thenPageContainsResources(){
+ Response response = RestAssured.given().get(getURL() + "?page=1&size=2" );
+ assertFalse(response.getBody().jsonPath().getList("content").isEmpty() );
+ }
+
+}
diff --git a/spring-rest-docs/src/main/java/com/example/CRUDController.java b/spring-rest-docs/src/main/java/com/example/CRUDController.java
index 818b29d3a6..ff8c91d6cd 100644
--- a/spring-rest-docs/src/main/java/com/example/CRUDController.java
+++ b/spring-rest-docs/src/main/java/com/example/CRUDController.java
@@ -17,39 +17,39 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/crud")
public class CRUDController {
-
- @RequestMapping(method=RequestMethod.GET)
- @ResponseStatus(HttpStatus.OK)
- public List read(@RequestBody CrudInput crudInput) {
- List returnList=new ArrayList();
- returnList.add(crudInput);
- return returnList;
- }
-
- @ResponseStatus(HttpStatus.CREATED)
- @RequestMapping(method=RequestMethod.POST)
- public HttpHeaders save(@RequestBody CrudInput crudInput) {
- HttpHeaders httpHeaders = new HttpHeaders();
- httpHeaders.setLocation(linkTo(CRUDController.class).slash(crudInput.getTitle()).toUri());
- return httpHeaders;
- }
-
- @RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
- @ResponseStatus(HttpStatus.OK)
- HttpHeaders delete(@RequestBody CrudInput crudInput) {
- HttpHeaders httpHeaders = new HttpHeaders();
- return httpHeaders;
- }
-
- @RequestMapping(value = "/{id}", method = RequestMethod.PUT)
- @ResponseStatus(HttpStatus.ACCEPTED)
- void put(@PathVariable("id") long id, @RequestBody CrudInput crudInput) {
-
- }
-
- @RequestMapping(value = "/{id}", method = RequestMethod.PATCH)
- @ResponseStatus(HttpStatus.NO_CONTENT)
- void patch(@PathVariable("id") long id, @RequestBody CrudInput crudInput) {
-
- }
+
+ @RequestMapping(method = RequestMethod.GET)
+ @ResponseStatus(HttpStatus.OK)
+ public List read(@RequestBody CrudInput crudInput) {
+ List returnList = new ArrayList();
+ returnList.add(crudInput);
+ return returnList;
+ }
+
+ @ResponseStatus(HttpStatus.CREATED)
+ @RequestMapping(method = RequestMethod.POST)
+ public HttpHeaders save(@RequestBody CrudInput crudInput) {
+ HttpHeaders httpHeaders = new HttpHeaders();
+ httpHeaders.setLocation(linkTo(CRUDController.class).slash(crudInput.getTitle()).toUri());
+ return httpHeaders;
+ }
+
+ @RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
+ @ResponseStatus(HttpStatus.OK)
+ HttpHeaders delete(@RequestBody CrudInput crudInput) {
+ HttpHeaders httpHeaders = new HttpHeaders();
+ return httpHeaders;
+ }
+
+ @RequestMapping(value = "/{id}", method = RequestMethod.PUT)
+ @ResponseStatus(HttpStatus.ACCEPTED)
+ void put(@PathVariable("id") long id, @RequestBody CrudInput crudInput) {
+
+ }
+
+ @RequestMapping(value = "/{id}", method = RequestMethod.PATCH)
+ @ResponseStatus(HttpStatus.NO_CONTENT)
+ void patch(@PathVariable("id") long id, @RequestBody CrudInput crudInput) {
+
+ }
}
diff --git a/spring-rest-docs/src/main/java/com/example/CrudInput.java b/spring-rest-docs/src/main/java/com/example/CrudInput.java
index 3d91b7d45a..36ad67eb21 100644
--- a/spring-rest-docs/src/main/java/com/example/CrudInput.java
+++ b/spring-rest-docs/src/main/java/com/example/CrudInput.java
@@ -10,33 +10,32 @@ import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
public class CrudInput {
-
- //@NotBlank
- private final String title;
- private final String body;
+ // @NotBlank
+ private final String title;
- private final List tagUris;
+ private final String body;
- @JsonCreator
- public CrudInput(@JsonProperty("title") String title,
- @JsonProperty("body") String body, @JsonProperty("tags") List tagUris) {
- this.title = title;
- this.body = body;
- this.tagUris = tagUris == null ? Collections.emptyList() : tagUris;
- }
+ private final List tagUris;
- public String getTitle() {
- return title;
- }
+ @JsonCreator
+ public CrudInput(@JsonProperty("title") String title, @JsonProperty("body") String body, @JsonProperty("tags") List tagUris) {
+ this.title = title;
+ this.body = body;
+ this.tagUris = tagUris == null ? Collections. emptyList() : tagUris;
+ }
- public String getBody() {
- return body;
- }
+ public String getTitle() {
+ return title;
+ }
- @JsonProperty("tags")
- public List getTagUris() {
- return this.tagUris;
- }
+ public String getBody() {
+ return body;
+ }
+
+ @JsonProperty("tags")
+ public List getTagUris() {
+ return this.tagUris;
+ }
}
\ No newline at end of file
diff --git a/spring-rest-docs/src/main/java/com/example/IndexController.java b/spring-rest-docs/src/main/java/com/example/IndexController.java
index a6b4537c43..6b896da416 100644
--- a/spring-rest-docs/src/main/java/com/example/IndexController.java
+++ b/spring-rest-docs/src/main/java/com/example/IndexController.java
@@ -1,6 +1,5 @@
package com.example;
-
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;
import org.springframework.hateoas.ResourceSupport;
@@ -12,11 +11,11 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping("/")
public class IndexController {
- @RequestMapping(method=RequestMethod.GET)
- public ResourceSupport index() {
- ResourceSupport index = new ResourceSupport();
- index.add(linkTo(CRUDController.class).withRel("crud"));
- return index;
- }
+ @RequestMapping(method = RequestMethod.GET)
+ public ResourceSupport index() {
+ ResourceSupport index = new ResourceSupport();
+ index.add(linkTo(CRUDController.class).withRel("crud"));
+ return index;
+ }
}
\ No newline at end of file
diff --git a/spring-rest-docs/src/main/java/com/example/SpringRestDocsApplication.java b/spring-rest-docs/src/main/java/com/example/SpringRestDocsApplication.java
index dd20ef324e..da09f9accc 100644
--- a/spring-rest-docs/src/main/java/com/example/SpringRestDocsApplication.java
+++ b/spring-rest-docs/src/main/java/com/example/SpringRestDocsApplication.java
@@ -6,7 +6,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SpringRestDocsApplication {
- public static void main(String[] args) {
- SpringApplication.run(SpringRestDocsApplication.class, args);
- }
+ public static void main(String[] args) {
+ SpringApplication.run(SpringRestDocsApplication.class, args);
+ }
}
diff --git a/spring-rest-docs/src/test/java/com/example/ApiDocumentation.java b/spring-rest-docs/src/test/java/com/example/ApiDocumentation.java
index 195b9dc514..5b753aff0c 100644
--- a/spring-rest-docs/src/test/java/com/example/ApiDocumentation.java
+++ b/spring-rest-docs/src/test/java/com/example/ApiDocumentation.java
@@ -56,55 +56,35 @@ public class ApiDocumentation {
@Before
public void setUp() {
this.document = document("{method-name}", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint()));
- this.mockMvc = MockMvcBuilders.webAppContextSetup(this.context)
- .apply(documentationConfiguration(this.restDocumentation))
- .alwaysDo(this.document)
- .build();
+ this.mockMvc = MockMvcBuilders.webAppContextSetup(this.context).apply(documentationConfiguration(this.restDocumentation)).alwaysDo(this.document).build();
}
-
@Test
public void headersExample() throws Exception {
- this.document.snippets(responseHeaders(headerWithName("Content-Type")
- .description("The Content-Type of the payload, e.g. `application/hal+json`")));
- this.mockMvc.perform(get("/"))
- .andExpect(status().isOk());
+ this.document.snippets(responseHeaders(headerWithName("Content-Type").description("The Content-Type of the payload, e.g. `application/hal+json`")));
+ this.mockMvc.perform(get("/")).andExpect(status().isOk());
}
@Test
public void indexExample() throws Exception {
- this.document.snippets(
- links(linkWithRel("crud").description("The <>")),
- responseFields(fieldWithPath("_links").description("<> to other resources"))
- );
- this.mockMvc.perform(get("/"))
- .andExpect(status().isOk());
+ this.document.snippets(links(linkWithRel("crud").description("The <>")), responseFields(fieldWithPath("_links").description("<> to other resources")));
+ this.mockMvc.perform(get("/")).andExpect(status().isOk());
}
-
@Test
public void crudGetExample() throws Exception {
Map tag = new HashMap<>();
tag.put("name", "GET");
- String tagLocation = this.mockMvc.perform(get("/crud")
- .contentType(MediaTypes.HAL_JSON)
- .content(this.objectMapper.writeValueAsString(tag)))
- .andExpect(status().isOk())
- .andReturn()
- .getResponse()
- .getHeader("Location");
+ String tagLocation = this.mockMvc.perform(get("/crud").contentType(MediaTypes.HAL_JSON).content(this.objectMapper.writeValueAsString(tag))).andExpect(status().isOk()).andReturn().getResponse().getHeader("Location");
Map crud = new HashMap<>();
crud.put("title", "Sample Model");
crud.put("body", "http://www.baeldung.com/");
crud.put("tags", singletonList(tagLocation));
- this.mockMvc.perform(get("/crud")
- .contentType(MediaTypes.HAL_JSON)
- .content(this.objectMapper.writeValueAsString(crud)))
- .andExpect(status().isOk());
+ this.mockMvc.perform(get("/crud").contentType(MediaTypes.HAL_JSON).content(this.objectMapper.writeValueAsString(crud))).andExpect(status().isOk());
}
@Test
@@ -112,13 +92,7 @@ public class ApiDocumentation {
Map tag = new HashMap<>();
tag.put("name", "CREATE");
- String tagLocation = this.mockMvc.perform(post("/crud")
- .contentType(MediaTypes.HAL_JSON)
- .content(this.objectMapper.writeValueAsString(tag)))
- .andExpect(status().isCreated())
- .andReturn()
- .getResponse()
- .getHeader("Location");
+ String tagLocation = this.mockMvc.perform(post("/crud").contentType(MediaTypes.HAL_JSON).content(this.objectMapper.writeValueAsString(tag))).andExpect(status().isCreated()).andReturn().getResponse().getHeader("Location");
Map crud = new HashMap<>();
crud.put("title", "Sample Model");
@@ -126,13 +100,9 @@ public class ApiDocumentation {
crud.put("tags", singletonList(tagLocation));
ConstrainedFields fields = new ConstrainedFields(CrudInput.class);
- this.document.snippets(requestFields(
- fields.withPath("title").description("The title of the note"),
- fields.withPath("body").description("The body of the note"),
- fields.withPath("tags").description("An array of tag resource URIs")));
+ this.document.snippets(requestFields(fields.withPath("title").description("The title of the note"), fields.withPath("body").description("The body of the note"), fields.withPath("tags").description("An array of tag resource URIs")));
this.mockMvc.perform(post("/crud").contentType(MediaTypes.HAL_JSON).content(this.objectMapper.writeValueAsString(crud))).andExpect(status().isCreated());
-
}
@Test
@@ -141,23 +111,14 @@ public class ApiDocumentation {
Map tag = new HashMap<>();
tag.put("name", "DELETE");
- String tagLocation = this.mockMvc.perform(delete("/crud/10")
- .contentType(MediaTypes.HAL_JSON)
- .content(this.objectMapper.writeValueAsString(tag)))
- .andExpect(status().isOk())
- .andReturn()
- .getResponse()
- .getHeader("Location");
+ String tagLocation = this.mockMvc.perform(delete("/crud/10").contentType(MediaTypes.HAL_JSON).content(this.objectMapper.writeValueAsString(tag))).andExpect(status().isOk()).andReturn().getResponse().getHeader("Location");
Map crud = new HashMap<>();
crud.put("title", "Sample Model");
crud.put("body", "http://www.baeldung.com/");
crud.put("tags", singletonList(tagLocation));
- this.mockMvc.perform(delete("/crud/10")
- .contentType(MediaTypes.HAL_JSON)
- .content(this.objectMapper.writeValueAsString(crud)))
- .andExpect(status().isOk());
+ this.mockMvc.perform(delete("/crud/10").contentType(MediaTypes.HAL_JSON).content(this.objectMapper.writeValueAsString(crud))).andExpect(status().isOk());
}
@Test
@@ -166,51 +127,31 @@ public class ApiDocumentation {
Map tag = new HashMap<>();
tag.put("name", "PATCH");
- String tagLocation = this.mockMvc.perform(patch("/crud/10")
- .contentType(MediaTypes.HAL_JSON)
- .content(this.objectMapper.writeValueAsString(tag)))
- .andExpect(status().isNoContent())
- .andReturn()
- .getResponse()
- .getHeader("Location");
+ String tagLocation = this.mockMvc.perform(patch("/crud/10").contentType(MediaTypes.HAL_JSON).content(this.objectMapper.writeValueAsString(tag))).andExpect(status().isNoContent()).andReturn().getResponse().getHeader("Location");
Map crud = new HashMap<>();
crud.put("title", "Sample Model");
crud.put("body", "http://www.baeldung.com/");
crud.put("tags", singletonList(tagLocation));
- this.mockMvc.perform(patch("/crud/10")
- .contentType(MediaTypes.HAL_JSON)
- .content(this.objectMapper.writeValueAsString(crud)))
- .andExpect(status().isNoContent());
+ this.mockMvc.perform(patch("/crud/10").contentType(MediaTypes.HAL_JSON).content(this.objectMapper.writeValueAsString(crud))).andExpect(status().isNoContent());
}
-
@Test
public void crudPutExample() throws Exception {
Map tag = new HashMap<>();
tag.put("name", "PUT");
- String tagLocation = this.mockMvc.perform(put("/crud/10")
- .contentType(MediaTypes.HAL_JSON)
- .content(this.objectMapper.writeValueAsString(tag)))
- .andExpect(status().isAccepted())
- .andReturn()
- .getResponse()
- .getHeader("Location");
+ String tagLocation = this.mockMvc.perform(put("/crud/10").contentType(MediaTypes.HAL_JSON).content(this.objectMapper.writeValueAsString(tag))).andExpect(status().isAccepted()).andReturn().getResponse().getHeader("Location");
Map crud = new HashMap<>();
crud.put("title", "Sample Model");
crud.put("body", "http://www.baeldung.com/");
crud.put("tags", singletonList(tagLocation));
- this.mockMvc.perform(put("/crud/10")
- .contentType(MediaTypes.HAL_JSON)
- .content(this.objectMapper.writeValueAsString(crud)))
- .andExpect(status().isAccepted());
+ this.mockMvc.perform(put("/crud/10").contentType(MediaTypes.HAL_JSON).content(this.objectMapper.writeValueAsString(crud))).andExpect(status().isAccepted());
}
-
@Test
public void contextLoads() {
}
@@ -224,11 +165,8 @@ public class ApiDocumentation {
}
private FieldDescriptor withPath(String path) {
- return fieldWithPath(path)
- .attributes(key("constraints")
- .value(collectionToDelimitedString(this.constraintDescriptions.descriptionsForProperty(path), ". ")));
+ return fieldWithPath(path).attributes(key("constraints").value(collectionToDelimitedString(this.constraintDescriptions.descriptionsForProperty(path), ". ")));
}
}
-
}
diff --git a/spring-rest-docs/src/test/java/com/example/GettingStartedDocumentation.java b/spring-rest-docs/src/test/java/com/example/GettingStartedDocumentation.java
index 7f3c4db1f9..7aea9d303c 100644
--- a/spring-rest-docs/src/test/java/com/example/GettingStartedDocumentation.java
+++ b/spring-rest-docs/src/test/java/com/example/GettingStartedDocumentation.java
@@ -46,113 +46,105 @@ public class GettingStartedDocumentation {
private MockMvc mockMvc;
-
@Before
public void setUp() {
- this.mockMvc = MockMvcBuilders.webAppContextSetup(this.context)
- .apply(documentationConfiguration(this.restDocumentation))
- .alwaysDo(document("{method-name}/{step}/",
- preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint())))
- .build();
+ this.mockMvc = MockMvcBuilders.webAppContextSetup(this.context).apply(documentationConfiguration(this.restDocumentation)).alwaysDo(document("{method-name}/{step}/", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint()))).build();
}
@Test
public void index() throws Exception {
- this.mockMvc.perform(get("/").accept(MediaTypes.HAL_JSON))
- .andExpect(status().isOk())
- .andExpect(jsonPath("_links.crud", is(notNullValue())))
- .andExpect(jsonPath("_links.crud", is(notNullValue())));
+ this.mockMvc.perform(get("/").accept(MediaTypes.HAL_JSON)).andExpect(status().isOk()).andExpect(jsonPath("_links.crud", is(notNullValue()))).andExpect(jsonPath("_links.crud", is(notNullValue())));
}
-// String createNote() throws Exception {
-// Map note = new HashMap();
-// note.put("title", "Note creation with cURL");
-// note.put("body", "An example of how to create a note using curl");
-// String noteLocation = this.mockMvc.perform(post("/crud")
-// .contentType(MediaTypes.HAL_JSON)
-// .content(objectMapper.writeValueAsString(note)))
-// .andExpect(status().isCreated())
-// .andExpect(header().string("Location", notNullValue()))
-// .andReturn()
-// .getResponse()
-// .getHeader("Location");
-// return noteLocation;
-// }
-//
-// MvcResult getNote(String noteLocation) throws Exception {
-// return this.mockMvc.perform(get(noteLocation))
-// .andExpect(status().isOk())
-// .andExpect(jsonPath("title", is(notNullValue())))
-// .andExpect(jsonPath("body", is(notNullValue())))
-// .andExpect(jsonPath("_links.crud", is(notNullValue())))
-// .andReturn();
-// }
-//
-//
-// String createTag() throws Exception, JsonProcessingException {
-// Map tag = new HashMap();
-// tag.put("name", "getting-started");
-// String tagLocation = this.mockMvc.perform(post("/crud")
-// .contentType(MediaTypes.HAL_JSON)
-// .content(objectMapper.writeValueAsString(tag)))
-// .andExpect(status().isCreated())
-// .andExpect(header().string("Location", notNullValue()))
-// .andReturn()
-// .getResponse()
-// .getHeader("Location");
-// return tagLocation;
-// }
-//
-// void getTag(String tagLocation) throws Exception {
-// this.mockMvc.perform(get(tagLocation)).andExpect(status().isOk())
-// .andExpect(jsonPath("name", is(notNullValue())))
-// .andExpect(jsonPath("_links.tagged-notes", is(notNullValue())));
-// }
-//
-// String createTaggedNote(String tag) throws Exception {
-// Map note = new HashMap();
-// note.put("title", "Tagged note creation with cURL");
-// note.put("body", "An example of how to create a tagged note using cURL");
-// note.put("tags", Arrays.asList(tag));
-//
-// String noteLocation = this.mockMvc.perform(post("/notes")
-// .contentType(MediaTypes.HAL_JSON)
-// .content(objectMapper.writeValueAsString(note)))
-// .andExpect(status().isCreated())
-// .andExpect(header().string("Location", notNullValue()))
-// .andReturn()
-// .getResponse()
-// .getHeader("Location");
-// return noteLocation;
-// }
-//
-// void getTags(String noteTagsLocation) throws Exception {
-// this.mockMvc.perform(get(noteTagsLocation))
-// .andExpect(status().isOk())
-// .andExpect(jsonPath("_embedded.tags", hasSize(1)));
-// }
-//
-// void tagExistingNote(String noteLocation, String tagLocation) throws Exception {
-// Map update = new HashMap();
-// update.put("tags", Arrays.asList(tagLocation));
-// this.mockMvc.perform(patch(noteLocation)
-// .contentType(MediaTypes.HAL_JSON)
-// .content(objectMapper.writeValueAsString(update)))
-// .andExpect(status().isNoContent());
-// }
-//
-// MvcResult getTaggedExistingNote(String noteLocation) throws Exception {
-// return this.mockMvc.perform(get(noteLocation)).andExpect(status().isOk()).andReturn();
-// }
-//
-// void getTagsForExistingNote(String noteTagsLocation) throws Exception {
-// this.mockMvc.perform(get(noteTagsLocation))
-// .andExpect(status().isOk()).andExpect(jsonPath("_embedded.tags", hasSize(1)));
-// }
-//
-// private String getLink(MvcResult result, String rel)
-// throws UnsupportedEncodingException {
-// return JsonPath.parse(result.getResponse().getContentAsString()).read("_links." + rel + ".href");
-// }
+ // String createNote() throws Exception {
+ // Map note = new HashMap();
+ // note.put("title", "Note creation with cURL");
+ // note.put("body", "An example of how to create a note using curl");
+ // String noteLocation = this.mockMvc.perform(post("/crud")
+ // .contentType(MediaTypes.HAL_JSON)
+ // .content(objectMapper.writeValueAsString(note)))
+ // .andExpect(status().isCreated())
+ // .andExpect(header().string("Location", notNullValue()))
+ // .andReturn()
+ // .getResponse()
+ // .getHeader("Location");
+ // return noteLocation;
+ // }
+ //
+ // MvcResult getNote(String noteLocation) throws Exception {
+ // return this.mockMvc.perform(get(noteLocation))
+ // .andExpect(status().isOk())
+ // .andExpect(jsonPath("title", is(notNullValue())))
+ // .andExpect(jsonPath("body", is(notNullValue())))
+ // .andExpect(jsonPath("_links.crud", is(notNullValue())))
+ // .andReturn();
+ // }
+ //
+ //
+ // String createTag() throws Exception, JsonProcessingException {
+ // Map tag = new HashMap();
+ // tag.put("name", "getting-started");
+ // String tagLocation = this.mockMvc.perform(post("/crud")
+ // .contentType(MediaTypes.HAL_JSON)
+ // .content(objectMapper.writeValueAsString(tag)))
+ // .andExpect(status().isCreated())
+ // .andExpect(header().string("Location", notNullValue()))
+ // .andReturn()
+ // .getResponse()
+ // .getHeader("Location");
+ // return tagLocation;
+ // }
+ //
+ // void getTag(String tagLocation) throws Exception {
+ // this.mockMvc.perform(get(tagLocation)).andExpect(status().isOk())
+ // .andExpect(jsonPath("name", is(notNullValue())))
+ // .andExpect(jsonPath("_links.tagged-notes", is(notNullValue())));
+ // }
+ //
+ // String createTaggedNote(String tag) throws Exception {
+ // Map note = new HashMap();
+ // note.put("title", "Tagged note creation with cURL");
+ // note.put("body", "An example of how to create a tagged note using cURL");
+ // note.put("tags", Arrays.asList(tag));
+ //
+ // String noteLocation = this.mockMvc.perform(post("/notes")
+ // .contentType(MediaTypes.HAL_JSON)
+ // .content(objectMapper.writeValueAsString(note)))
+ // .andExpect(status().isCreated())
+ // .andExpect(header().string("Location", notNullValue()))
+ // .andReturn()
+ // .getResponse()
+ // .getHeader("Location");
+ // return noteLocation;
+ // }
+ //
+ // void getTags(String noteTagsLocation) throws Exception {
+ // this.mockMvc.perform(get(noteTagsLocation))
+ // .andExpect(status().isOk())
+ // .andExpect(jsonPath("_embedded.tags", hasSize(1)));
+ // }
+ //
+ // void tagExistingNote(String noteLocation, String tagLocation) throws Exception {
+ // Map update = new HashMap();
+ // update.put("tags", Arrays.asList(tagLocation));
+ // this.mockMvc.perform(patch(noteLocation)
+ // .contentType(MediaTypes.HAL_JSON)
+ // .content(objectMapper.writeValueAsString(update)))
+ // .andExpect(status().isNoContent());
+ // }
+ //
+ // MvcResult getTaggedExistingNote(String noteLocation) throws Exception {
+ // return this.mockMvc.perform(get(noteLocation)).andExpect(status().isOk()).andReturn();
+ // }
+ //
+ // void getTagsForExistingNote(String noteTagsLocation) throws Exception {
+ // this.mockMvc.perform(get(noteTagsLocation))
+ // .andExpect(status().isOk()).andExpect(jsonPath("_embedded.tags", hasSize(1)));
+ // }
+ //
+ // private String getLink(MvcResult result, String rel)
+ // throws UnsupportedEncodingException {
+ // return JsonPath.parse(result.getResponse().getContentAsString()).read("_links." + rel + ".href");
+ // }
}
diff --git a/spring-rest/.classpath b/spring-rest/.classpath
deleted file mode 100644
index 6b533711d3..0000000000
--- a/spring-rest/.classpath
+++ /dev/null
@@ -1,37 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/spring-rest/.externalToolBuilders/org.eclipse.wst.jsdt.core.javascriptValidator.launch b/spring-rest/.externalToolBuilders/org.eclipse.wst.jsdt.core.javascriptValidator.launch
deleted file mode 100644
index 627021fb96..0000000000
--- a/spring-rest/.externalToolBuilders/org.eclipse.wst.jsdt.core.javascriptValidator.launch
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
diff --git a/spring-rest/.project b/spring-rest/.project
deleted file mode 100644
index 525c5e7795..0000000000
--- a/spring-rest/.project
+++ /dev/null
@@ -1,37 +0,0 @@
-
-
- spring-rest
-
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
- org.eclipse.wst.common.project.facet.core.builder
-
-
-
-
- org.springframework.ide.eclipse.core.springbuilder
-
-
-
-
- org.eclipse.m2e.core.maven2Builder
-
-
-
-
-
- org.springframework.ide.eclipse.core.springnature
- org.eclipse.jem.workbench.JavaEMFNature
- org.eclipse.wst.common.modulecore.ModuleCoreNature
- org.eclipse.jdt.core.javanature
- org.eclipse.m2e.core.maven2Nature
- org.eclipse.wst.common.project.facet.core.nature
-
-
diff --git a/spring-rest/.settings/.jsdtscope b/spring-rest/.settings/.jsdtscope
deleted file mode 100644
index 7b3f0c8b9f..0000000000
--- a/spring-rest/.settings/.jsdtscope
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/spring-rest/.settings/org.eclipse.jdt.core.prefs b/spring-rest/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index b126d6476b..0000000000
--- a/spring-rest/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,95 +0,0 @@
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
-org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
-org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
-org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
-org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.8
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
-org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
-org.eclipse.jdt.core.compiler.problem.deadCode=warning
-org.eclipse.jdt.core.compiler.problem.deprecation=warning
-org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
-org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
-org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
-org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
-org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
-org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
-org.eclipse.jdt.core.compiler.problem.fieldHiding=error
-org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
-org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
-org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
-org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
-org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
-org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
-org.eclipse.jdt.core.compiler.problem.localVariableHiding=error
-org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
-org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
-org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
-org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
-org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
-org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
-org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
-org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
-org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
-org.eclipse.jdt.core.compiler.problem.nullReference=warning
-org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
-org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
-org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
-org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
-org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
-org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
-org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
-org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
-org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
-org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
-org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
-org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
-org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
-org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
-org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
-org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
-org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
-org.eclipse.jdt.core.compiler.problem.typeParameterHiding=error
-org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
-org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
-org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
-org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
-org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.unusedImport=warning
-org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
-org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
-org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
-org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
-org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
-org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
-org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.8
diff --git a/spring-rest/.settings/org.eclipse.jdt.ui.prefs b/spring-rest/.settings/org.eclipse.jdt.ui.prefs
deleted file mode 100644
index 471e9b0d81..0000000000
--- a/spring-rest/.settings/org.eclipse.jdt.ui.prefs
+++ /dev/null
@@ -1,55 +0,0 @@
-#Sat Jan 21 23:04:06 EET 2012
-eclipse.preferences.version=1
-editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
-sp_cleanup.add_default_serial_version_id=true
-sp_cleanup.add_generated_serial_version_id=false
-sp_cleanup.add_missing_annotations=true
-sp_cleanup.add_missing_deprecated_annotations=true
-sp_cleanup.add_missing_methods=false
-sp_cleanup.add_missing_nls_tags=false
-sp_cleanup.add_missing_override_annotations=true
-sp_cleanup.add_missing_override_annotations_interface_methods=true
-sp_cleanup.add_serial_version_id=false
-sp_cleanup.always_use_blocks=true
-sp_cleanup.always_use_parentheses_in_expressions=true
-sp_cleanup.always_use_this_for_non_static_field_access=false
-sp_cleanup.always_use_this_for_non_static_method_access=false
-sp_cleanup.convert_to_enhanced_for_loop=true
-sp_cleanup.correct_indentation=true
-sp_cleanup.format_source_code=true
-sp_cleanup.format_source_code_changes_only=true
-sp_cleanup.make_local_variable_final=true
-sp_cleanup.make_parameters_final=true
-sp_cleanup.make_private_fields_final=false
-sp_cleanup.make_type_abstract_if_missing_method=false
-sp_cleanup.make_variable_declarations_final=true
-sp_cleanup.never_use_blocks=false
-sp_cleanup.never_use_parentheses_in_expressions=false
-sp_cleanup.on_save_use_additional_actions=true
-sp_cleanup.organize_imports=true
-sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_with_declaring_class=true
-sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
-sp_cleanup.remove_private_constructors=true
-sp_cleanup.remove_trailing_whitespaces=true
-sp_cleanup.remove_trailing_whitespaces_all=true
-sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
-sp_cleanup.remove_unnecessary_casts=true
-sp_cleanup.remove_unnecessary_nls_tags=false
-sp_cleanup.remove_unused_imports=true
-sp_cleanup.remove_unused_local_variables=false
-sp_cleanup.remove_unused_private_fields=true
-sp_cleanup.remove_unused_private_members=false
-sp_cleanup.remove_unused_private_methods=true
-sp_cleanup.remove_unused_private_types=true
-sp_cleanup.sort_members=false
-sp_cleanup.sort_members_all=false
-sp_cleanup.use_blocks=false
-sp_cleanup.use_blocks_only_for_return_and_throw=false
-sp_cleanup.use_parentheses_in_expressions=false
-sp_cleanup.use_this_for_non_static_field_access=true
-sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
-sp_cleanup.use_this_for_non_static_method_access=true
-sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/spring-rest/.settings/org.eclipse.m2e.core.prefs b/spring-rest/.settings/org.eclipse.m2e.core.prefs
deleted file mode 100644
index f897a7f1cb..0000000000
--- a/spring-rest/.settings/org.eclipse.m2e.core.prefs
+++ /dev/null
@@ -1,4 +0,0 @@
-activeProfiles=
-eclipse.preferences.version=1
-resolveWorkspaceProjects=true
-version=1
diff --git a/spring-rest/.settings/org.eclipse.m2e.wtp.prefs b/spring-rest/.settings/org.eclipse.m2e.wtp.prefs
deleted file mode 100644
index ef86089622..0000000000
--- a/spring-rest/.settings/org.eclipse.m2e.wtp.prefs
+++ /dev/null
@@ -1,2 +0,0 @@
-eclipse.preferences.version=1
-org.eclipse.m2e.wtp.enabledProjectSpecificPrefs=false
diff --git a/spring-rest/.settings/org.eclipse.wst.common.component b/spring-rest/.settings/org.eclipse.wst.common.component
deleted file mode 100644
index 8bb4ef127a..0000000000
--- a/spring-rest/.settings/org.eclipse.wst.common.component
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
-
-
-
diff --git a/spring-rest/.settings/org.eclipse.wst.common.project.facet.core.xml b/spring-rest/.settings/org.eclipse.wst.common.project.facet.core.xml
deleted file mode 100644
index 8a1c189419..0000000000
--- a/spring-rest/.settings/org.eclipse.wst.common.project.facet.core.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/spring-rest/.settings/org.eclipse.wst.jsdt.ui.superType.container b/spring-rest/.settings/org.eclipse.wst.jsdt.ui.superType.container
deleted file mode 100644
index 3bd5d0a480..0000000000
--- a/spring-rest/.settings/org.eclipse.wst.jsdt.ui.superType.container
+++ /dev/null
@@ -1 +0,0 @@
-org.eclipse.wst.jsdt.launching.baseBrowserLibrary
\ No newline at end of file
diff --git a/spring-rest/.settings/org.eclipse.wst.jsdt.ui.superType.name b/spring-rest/.settings/org.eclipse.wst.jsdt.ui.superType.name
deleted file mode 100644
index 05bd71b6ec..0000000000
--- a/spring-rest/.settings/org.eclipse.wst.jsdt.ui.superType.name
+++ /dev/null
@@ -1 +0,0 @@
-Window
\ No newline at end of file
diff --git a/spring-rest/.settings/org.eclipse.wst.validation.prefs b/spring-rest/.settings/org.eclipse.wst.validation.prefs
deleted file mode 100644
index 0d0aee4f72..0000000000
--- a/spring-rest/.settings/org.eclipse.wst.validation.prefs
+++ /dev/null
@@ -1,15 +0,0 @@
-DELEGATES_PREFERENCE=delegateValidatorList
-USER_BUILD_PREFERENCE=enabledBuildValidatorListorg.eclipse.jst.j2ee.internal.classpathdep.ClasspathDependencyValidator;
-USER_MANUAL_PREFERENCE=enabledManualValidatorListorg.eclipse.jst.j2ee.internal.classpathdep.ClasspathDependencyValidator;
-USER_PREFERENCE=overrideGlobalPreferencestruedisableAllValidationfalseversion1.2.402.v201212031633
-disabled=06target
-eclipse.preferences.version=1
-override=true
-suspend=false
-vals/org.eclipse.jst.jsf.ui.JSFAppConfigValidator/global=FF01
-vals/org.eclipse.jst.jsp.core.JSPBatchValidator/global=FF01
-vals/org.eclipse.jst.jsp.core.JSPContentValidator/global=FF01
-vals/org.eclipse.jst.jsp.core.TLDValidator/global=FF01
-vals/org.eclipse.wst.dtd.core.dtdDTDValidator/global=FF01
-vals/org.eclipse.wst.jsdt.web.core.JsBatchValidator/global=TF02
-vf.version=3
diff --git a/spring-rest/.settings/org.eclipse.wst.ws.service.policy.prefs b/spring-rest/.settings/org.eclipse.wst.ws.service.policy.prefs
deleted file mode 100644
index 9cfcabe16f..0000000000
--- a/spring-rest/.settings/org.eclipse.wst.ws.service.policy.prefs
+++ /dev/null
@@ -1,2 +0,0 @@
-eclipse.preferences.version=1
-org.eclipse.wst.ws.service.policy.projectEnabled=false
diff --git a/spring-rest/.springBeans b/spring-rest/.springBeans
deleted file mode 100644
index a79097f40d..0000000000
--- a/spring-rest/.springBeans
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
- 1
-
-
-
-
-
-
- src/main/webapp/WEB-INF/api-servlet.xml
-
-
-
-
diff --git a/spring-rest/src/main/java/org/baeldung/config/WebConfig.java b/spring-rest/src/main/java/org/baeldung/config/WebConfig.java
index 120f1b272a..d5cd6e1eae 100644
--- a/spring-rest/src/main/java/org/baeldung/config/WebConfig.java
+++ b/spring-rest/src/main/java/org/baeldung/config/WebConfig.java
@@ -1,53 +1,53 @@
-package org.baeldung.config;
-
-import java.text.SimpleDateFormat;
-import java.util.List;
-
-import org.baeldung.config.converter.KryoHttpMessageConverter;
-import org.springframework.context.annotation.ComponentScan;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.http.converter.HttpMessageConverter;
-import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
-import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
-import org.springframework.http.converter.protobuf.ProtobufHttpMessageConverter;
-import org.springframework.http.converter.xml.MarshallingHttpMessageConverter;
-import org.springframework.oxm.xstream.XStreamMarshaller;
-import org.springframework.web.servlet.config.annotation.EnableWebMvc;
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
-
-@Configuration
-@EnableWebMvc
-@ComponentScan({ "org.baeldung.web" })
-public class WebConfig extends WebMvcConfigurerAdapter {
-
- public WebConfig() {
- super();
- }
-
- //
-
- @Override
- public void configureMessageConverters(final List> messageConverters) {
- messageConverters.add(createXmlHttpMessageConverter());
- // messageConverters.add(new MappingJackson2HttpMessageConverter());
-
- final Jackson2ObjectMapperBuilder builder = new Jackson2ObjectMapperBuilder();
- builder.indentOutput(true).dateFormat(new SimpleDateFormat("dd-MM-yyyy hh:mm"));
- messageConverters.add(new MappingJackson2HttpMessageConverter(builder.build()));
- // messageConverters.add(new MappingJackson2XmlHttpMessageConverter(builder.createXmlMapper(true).build()));
- messageConverters.add(new ProtobufHttpMessageConverter());
- messageConverters.add(new KryoHttpMessageConverter());
- super.configureMessageConverters(messageConverters);
- }
-
- private HttpMessageConverter