diff --git a/pom.xml b/pom.xml index 9dea3dc79d..1de53f220e 100644 --- a/pom.xml +++ b/pom.xml @@ -143,6 +143,7 @@ spring-boot-admin spring-boot-ops spring-boot-security + spring-boot-mvc spring-cloud-data-flow spring-cloud spring-core diff --git a/spring-boot-mvc/.gitignore b/spring-boot-mvc/.gitignore new file mode 100644 index 0000000000..82eca336e3 --- /dev/null +++ b/spring-boot-mvc/.gitignore @@ -0,0 +1,25 @@ +/target/ +!.mvn/wrapper/maven-wrapper.jar + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/build/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ \ No newline at end of file diff --git a/spring-boot-mvc/pom.xml b/spring-boot-mvc/pom.xml new file mode 100644 index 0000000000..81968973f8 --- /dev/null +++ b/spring-boot-mvc/pom.xml @@ -0,0 +1,50 @@ + + + 4.0.0 + + com.baeldung + spring-boot-mvc + 0.0.1-SNAPSHOT + jar + + spring-boot-mvc + Demo project for Spring Boot + + + org.springframework.boot + spring-boot-starter-parent + 2.0.2.RELEASE + + + + + UTF-8 + UTF-8 + 1.8 + + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + + diff --git a/spring-boot-mvc/src/main/java/com/baeldung/springbootmvc/SpringBootMvcApplication.java b/spring-boot-mvc/src/main/java/com/baeldung/springbootmvc/SpringBootMvcApplication.java new file mode 100644 index 0000000000..c4213af0a3 --- /dev/null +++ b/spring-boot-mvc/src/main/java/com/baeldung/springbootmvc/SpringBootMvcApplication.java @@ -0,0 +1,13 @@ +package com.baeldung.springbootmvc; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.web.servlet.config.annotation.EnableWebMvc; + +@SpringBootApplication +public class SpringBootMvcApplication { + + public static void main(String[] args) { + SpringApplication.run(SpringBootMvcApplication.class, args); + } +} diff --git a/spring-rest/src/main/java/org/baeldung/config/FaviconConfiguration.java b/spring-boot-mvc/src/main/java/com/baeldung/springbootmvc/config/FaviconConfiguration.java similarity index 92% rename from spring-rest/src/main/java/org/baeldung/config/FaviconConfiguration.java rename to spring-boot-mvc/src/main/java/com/baeldung/springbootmvc/config/FaviconConfiguration.java index 78a2a3eb2c..1ee13ccec2 100644 --- a/spring-rest/src/main/java/org/baeldung/config/FaviconConfiguration.java +++ b/spring-boot-mvc/src/main/java/com/baeldung/springbootmvc/config/FaviconConfiguration.java @@ -1,4 +1,4 @@ -package org.baeldung.config; +package com.baeldung.springbootmvc.config; import java.util.Arrays; import java.util.Collections; @@ -8,7 +8,6 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; -import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; @@ -28,7 +27,7 @@ public class FaviconConfiguration { @Bean protected ResourceHttpRequestHandler faviconRequestHandler() { ResourceHttpRequestHandler requestHandler = new ResourceHttpRequestHandler(); - ClassPathResource classPathResource = new ClassPathResource("com/baeldung/produceimage/images"); + ClassPathResource classPathResource = new ClassPathResource("com/baeldung/images"); List locations = Arrays.asList(classPathResource); requestHandler.setLocations(locations); return requestHandler; diff --git a/spring-boot-mvc/src/main/resources/application.properties b/spring-boot-mvc/src/main/resources/application.properties new file mode 100644 index 0000000000..e69de29bb2 diff --git a/spring-rest/src/main/resources/static/favicon.ico b/spring-boot-mvc/src/main/resources/com/baeldung/images/favicon.ico similarity index 100% rename from spring-rest/src/main/resources/static/favicon.ico rename to spring-boot-mvc/src/main/resources/com/baeldung/images/favicon.ico diff --git a/spring-boot-mvc/src/main/resources/favicon.ico b/spring-boot-mvc/src/main/resources/favicon.ico new file mode 100644 index 0000000000..64105ac11c Binary files /dev/null and b/spring-boot-mvc/src/main/resources/favicon.ico differ diff --git a/spring-boot-mvc/src/main/resources/static/favicon.ico b/spring-boot-mvc/src/main/resources/static/favicon.ico new file mode 100644 index 0000000000..64105ac11c Binary files /dev/null and b/spring-boot-mvc/src/main/resources/static/favicon.ico differ diff --git a/spring-boot-mvc/src/main/resources/static/index.html b/spring-boot-mvc/src/main/resources/static/index.html new file mode 100644 index 0000000000..9f55d12685 --- /dev/null +++ b/spring-boot-mvc/src/main/resources/static/index.html @@ -0,0 +1 @@ +Welcome to Baeldung \ No newline at end of file diff --git a/spring-boot-mvc/src/test/java/com/baeldung/springbootmvc/SpringBootMvcApplicationTests.java b/spring-boot-mvc/src/test/java/com/baeldung/springbootmvc/SpringBootMvcApplicationTests.java new file mode 100644 index 0000000000..1add635ed8 --- /dev/null +++ b/spring-boot-mvc/src/test/java/com/baeldung/springbootmvc/SpringBootMvcApplicationTests.java @@ -0,0 +1,16 @@ +package com.baeldung.springbootmvc; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class SpringBootMvcApplicationTests { + + @Test + public void contextLoads() { + } + +} diff --git a/spring-rest/src/main/resources/application.properties b/spring-rest/src/main/resources/application.properties index 5ea345c395..dd7e4e2f2d 100644 --- a/spring-rest/src/main/resources/application.properties +++ b/spring-rest/src/main/resources/application.properties @@ -1,3 +1,2 @@ server.port= 8082 -server.servlet.context-path=/spring-rest -spring.mvc.favicon.enabled=false \ No newline at end of file +server.servlet.context-path=/spring-rest \ No newline at end of file