diff --git a/spring-boot-mvc/pom.xml b/spring-boot-mvc/pom.xml
index a414ed7bb2..a825a167ad 100644
--- a/spring-boot-mvc/pom.xml
+++ b/spring-boot-mvc/pom.xml
@@ -14,6 +14,15 @@
0.0.1-SNAPSHOT
../parent-boot-2
+
+
+
+
+ jcenter-snapshots
+ jcenter
+ http://oss.jfrog.org/artifactory/oss-snapshot-local/
+
+
@@ -34,7 +43,14 @@
org.springframework.boot
spring-boot-starter-thymeleaf
-
+
+ org.springframework.boot
+ spring-boot-starter-data-jpa
+
+
+ com.h2database
+ h2
+
@@ -82,6 +98,18 @@
springfox-swagger-ui
${spring.fox.version}
+
+
+ io.springfox
+ springfox-data-rest
+ ${spring.fox.version}
+
+
+
+ io.springfox
+ springfox-bean-validators
+ ${spring.fox.version}
+
org.apache.tomcat.embed
@@ -117,7 +145,7 @@
- 2.9.2
+ 3.0.0-SNAPSHOT
1.10.0
2.3.7
diff --git a/spring-boot-mvc/src/main/java/com/baeldung/swagger2boot/configuration/SpringFoxConfig.java b/spring-boot-mvc/src/main/java/com/baeldung/swagger2boot/configuration/SpringFoxConfig.java
index 68e2c55deb..434a8d77cb 100644
--- a/spring-boot-mvc/src/main/java/com/baeldung/swagger2boot/configuration/SpringFoxConfig.java
+++ b/spring-boot-mvc/src/main/java/com/baeldung/swagger2boot/configuration/SpringFoxConfig.java
@@ -1,22 +1,29 @@
package com.baeldung.swagger2boot.configuration;
+import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Import;
+
+import com.baeldung.swagger2boot.plugin.EmailAnnotationPlugin;
+
+import springfox.bean.validators.configuration.BeanValidatorPluginsConfiguration;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
+import springfox.documentation.spring.data.rest.configuration.SpringDataRestConfiguration;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger.web.*;
-import springfox.documentation.swagger2.annotations.EnableSwagger2;
+import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;
import java.util.Collections;
@Configuration
-@EnableSwagger2
-@ComponentScan("com.baeldung.swaggerboot.controller")
+@EnableSwagger2WebMvc
+@Import({SpringDataRestConfiguration.class, BeanValidatorPluginsConfiguration.class})
public class SpringFoxConfig {
private ApiInfo apiInfo() {
@@ -65,4 +72,8 @@ public class SpringFoxConfig {
.build();
}
+ @Bean
+ public EmailAnnotationPlugin emailPlugin() {
+ return new EmailAnnotationPlugin();
+ }
}
diff --git a/springfox/src/main/java/com/baeldung/springfox/model/User.java b/spring-boot-mvc/src/main/java/com/baeldung/swagger2boot/model/User.java
similarity index 96%
rename from springfox/src/main/java/com/baeldung/springfox/model/User.java
rename to spring-boot-mvc/src/main/java/com/baeldung/swagger2boot/model/User.java
index 20e74016f3..b724031536 100644
--- a/springfox/src/main/java/com/baeldung/springfox/model/User.java
+++ b/spring-boot-mvc/src/main/java/com/baeldung/swagger2boot/model/User.java
@@ -1,4 +1,4 @@
-package com.baeldung.springfox.model;
+package com.baeldung.swagger2boot.model;
import javax.persistence.Id;
import javax.validation.constraints.Email;
diff --git a/springfox/src/main/java/com/baeldung/springfox/plugin/EmailAnnotationPlugin.java b/spring-boot-mvc/src/main/java/com/baeldung/swagger2boot/plugin/EmailAnnotationPlugin.java
similarity index 96%
rename from springfox/src/main/java/com/baeldung/springfox/plugin/EmailAnnotationPlugin.java
rename to spring-boot-mvc/src/main/java/com/baeldung/swagger2boot/plugin/EmailAnnotationPlugin.java
index 2e5e57aec5..22ca144fb4 100644
--- a/springfox/src/main/java/com/baeldung/springfox/plugin/EmailAnnotationPlugin.java
+++ b/spring-boot-mvc/src/main/java/com/baeldung/swagger2boot/plugin/EmailAnnotationPlugin.java
@@ -1,4 +1,4 @@
-package com.baeldung.springfox.plugin;
+package com.baeldung.swagger2boot.plugin;
import static springfox.bean.validators.plugins.Validators.annotationFromBean;
diff --git a/springfox/src/main/java/com/baeldung/springfox/repository/UserRepository.java b/spring-boot-mvc/src/main/java/com/baeldung/swagger2boot/repository/UserRepository.java
similarity index 68%
rename from springfox/src/main/java/com/baeldung/springfox/repository/UserRepository.java
rename to spring-boot-mvc/src/main/java/com/baeldung/swagger2boot/repository/UserRepository.java
index 16303bc6d0..0cbffa06d4 100644
--- a/springfox/src/main/java/com/baeldung/springfox/repository/UserRepository.java
+++ b/spring-boot-mvc/src/main/java/com/baeldung/swagger2boot/repository/UserRepository.java
@@ -1,9 +1,9 @@
-package com.baeldung.springfox.repository;
+package com.baeldung.swagger2boot.repository;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
-import com.baeldung.springfox.model.User;
+import com.baeldung.swagger2boot.model.User;
@Repository
public interface UserRepository extends CrudRepository {
diff --git a/springfox/pom.xml b/springfox/pom.xml
deleted file mode 100644
index c620e49a3d..0000000000
--- a/springfox/pom.xml
+++ /dev/null
@@ -1,94 +0,0 @@
-
-
- 4.0.0
- com.baeldung.web
- springfox
- springfox
- SpringFox
- war
-
-
- parent-boot-2
- com.baeldung
- 0.0.1-SNAPSHOT
- ../parent-boot-2
-
-
-
-
- jcenter
- jcenter
- https://jcenter.bintray.com/
-
-
-
- jcenter-snapshots
- jcenter
- http://oss.jfrog.org/artifactory/oss-snapshot-local/
-
-
-
-
-
- org.springframework.boot
- spring-boot-starter-web
-
-
- org.springframework.boot
- spring-boot-starter-data-rest
-
-
- org.springframework.boot
- spring-boot-starter-data-jpa
-
-
- com.h2database
- h2
-
-
-
-
- io.springfox
- springfox-swagger2
- 3.0.0-SNAPSHOT
-
-
- io.springfox
- springfox-swagger-ui
- 3.0.0-SNAPSHOT
-
-
- io.springfox
- springfox-data-rest
- 3.0.0-SNAPSHOT
-
-
- io.springfox
- springfox-bean-validators
- 3.0.0-SNAPSHOT
-
-
-
-
- com.google.guava
- guava
- ${guava.version}
-
-
-
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
-
-
-
-
-
- com.baeldung.springfox.SpringfoxApplication
- 27.0.1-jre
-
-
diff --git a/springfox/src/main/java/com/baeldung/springfox/SpringfoxApplication.java b/springfox/src/main/java/com/baeldung/springfox/SpringfoxApplication.java
deleted file mode 100644
index 03f20c5d0a..0000000000
--- a/springfox/src/main/java/com/baeldung/springfox/SpringfoxApplication.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package com.baeldung.springfox;
-
-import static springfox.documentation.builders.PathSelectors.regex;
-
-import java.util.Collections;
-import java.util.function.Predicate;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.autoconfigure.domain.EntityScan;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.ComponentScan;
-import org.springframework.context.annotation.Import;
-import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
-
-import com.baeldung.springfox.plugin.EmailAnnotationPlugin;
-
-import springfox.bean.validators.configuration.BeanValidatorPluginsConfiguration;
-import springfox.documentation.service.ApiInfo;
-import springfox.documentation.spi.DocumentationType;
-import springfox.documentation.spring.data.rest.configuration.SpringDataRestConfiguration;
-import springfox.documentation.spring.web.plugins.Docket;
-import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;
-
-
-@SpringBootApplication
-@EnableSwagger2WebMvc
-@EntityScan("com.baeldung.springfox.model")
-@ComponentScan("com.baeldung.springfox.controller")
-@EnableJpaRepositories("com.baeldung.springfox.repository")
-@Import({SpringDataRestConfiguration.class, BeanValidatorPluginsConfiguration.class})
-public class SpringfoxApplication {
-
- public static void main(String[] args) {
- SpringApplication.run(SpringfoxApplication.class, args);
- }
-
- @Bean
- public Docket springfoxAppInfo() {
- return new Docket(DocumentationType.SWAGGER_2)
- .groupName("baeldung-springfox-api")
- .select()
- .paths(paths())
- .build()
- .apiInfo(apiInfo());
- }
-
- private Predicate paths() {
- return regex("/users.*").or(regex("/api.*"));
- }
-
- private ApiInfo apiInfo() {
- return new ApiInfo(
- "Springfox API specification",
- "User REST and Spring Data APIs",
- "",
- "",
- null,
- "License of API",
- "API license URL",
- Collections.emptyList());
- }
-
- @Bean
- public EmailAnnotationPlugin emailPlugin() {
- return new EmailAnnotationPlugin();
- }
-
-}
diff --git a/springfox/src/main/java/com/baeldung/springfox/controller/UserController.java b/springfox/src/main/java/com/baeldung/springfox/controller/UserController.java
deleted file mode 100644
index d70cc3e7a5..0000000000
--- a/springfox/src/main/java/com/baeldung/springfox/controller/UserController.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package com.baeldung.springfox.controller;
-
-import java.util.Optional;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.MediaType;
-import org.springframework.http.ResponseEntity;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.ResponseBody;
-
-import com.baeldung.springfox.model.User;
-import com.baeldung.springfox.repository.UserRepository;
-
-@Controller
-@RequestMapping(value = "/api/user", produces = MediaType.APPLICATION_JSON_VALUE)
-public class UserController {
-
- @Autowired
- private UserRepository userRepository;
-
- @PostMapping
- public @ResponseBody ResponseEntity createUser(@RequestBody User user) {
- userRepository.save(user);
- return new ResponseEntity<>(user, HttpStatus.OK);
- }
-
- @GetMapping
- public @ResponseBody ResponseEntity getUser(@RequestParam Long id) {
- Optional user = userRepository.findById(id);
- return new ResponseEntity<>(user.get(), HttpStatus.OK);
- }
-
-}
diff --git a/springfox/src/main/resources/application.properties b/springfox/src/main/resources/application.properties
deleted file mode 100644
index 3b4076297b..0000000000
--- a/springfox/src/main/resources/application.properties
+++ /dev/null
@@ -1,3 +0,0 @@
-### Spring Boot default error handling configurations
-#server.error.whitelabel.enabled=false
-#server.error.include-stacktrace=always