From f43db12fcbdac8b0c47cede959066f7de53ea46d Mon Sep 17 00:00:00 2001 From: vatsalgosar Date: Tue, 16 Jul 2019 01:55:08 +0530 Subject: [PATCH] BAEL-2728 | vatsalgosar@gmail.com - Adding spring-boot-configuration project to spring-boot-bootstrap module --- .../spring-boot-configuration}/README.md | 0 .../spring-boot-configuration}/pom.xml | 14 +-------- .../main/java/com/baeldung/Application.java | 9 ++++-- .../baeldung/controller/PersonController.java | 0 .../main/java/com/baeldung/domain/Person.java | 0 .../exception/PersonNotFoundException.java | 0 .../baeldung/repository/PersonRepository.java | 0 .../com/baeldung/service/PersonService.java | 2 +- .../src/main/resources/application.properties | 0 .../src/main/resources/schema.sql | 0 .../java/com/baeldung/ApplicationTests.java | 0 spring-boot-configuration/.gitignore | 31 ------------------- .../main/java/com/baeldung/SwaggerConfig.java | 22 ------------- 13 files changed, 9 insertions(+), 69 deletions(-) rename {spring-boot-configuration => spring-boot-bootstrap/spring-boot-configuration}/README.md (100%) rename {spring-boot-configuration => spring-boot-bootstrap/spring-boot-configuration}/pom.xml (84%) rename {spring-boot-configuration => spring-boot-bootstrap/spring-boot-configuration}/src/main/java/com/baeldung/Application.java (75%) rename {spring-boot-configuration => spring-boot-bootstrap/spring-boot-configuration}/src/main/java/com/baeldung/controller/PersonController.java (100%) rename {spring-boot-configuration => spring-boot-bootstrap/spring-boot-configuration}/src/main/java/com/baeldung/domain/Person.java (100%) rename {spring-boot-configuration => spring-boot-bootstrap/spring-boot-configuration}/src/main/java/com/baeldung/exception/PersonNotFoundException.java (100%) rename {spring-boot-configuration => spring-boot-bootstrap/spring-boot-configuration}/src/main/java/com/baeldung/repository/PersonRepository.java (100%) rename {spring-boot-configuration => spring-boot-bootstrap/spring-boot-configuration}/src/main/java/com/baeldung/service/PersonService.java (98%) rename {spring-boot-configuration => spring-boot-bootstrap/spring-boot-configuration}/src/main/resources/application.properties (100%) rename {spring-boot-configuration => spring-boot-bootstrap/spring-boot-configuration}/src/main/resources/schema.sql (100%) rename {spring-boot-configuration => spring-boot-bootstrap/spring-boot-configuration}/src/test/java/com/baeldung/ApplicationTests.java (100%) delete mode 100644 spring-boot-configuration/.gitignore delete mode 100644 spring-boot-configuration/src/main/java/com/baeldung/SwaggerConfig.java diff --git a/spring-boot-configuration/README.md b/spring-boot-bootstrap/spring-boot-configuration/README.md similarity index 100% rename from spring-boot-configuration/README.md rename to spring-boot-bootstrap/spring-boot-configuration/README.md diff --git a/spring-boot-configuration/pom.xml b/spring-boot-bootstrap/spring-boot-configuration/pom.xml similarity index 84% rename from spring-boot-configuration/pom.xml rename to spring-boot-bootstrap/spring-boot-configuration/pom.xml index ede2504272..02b2e53159 100644 --- a/spring-boot-configuration/pom.xml +++ b/spring-boot-bootstrap/spring-boot-configuration/pom.xml @@ -40,19 +40,7 @@ org.hibernate hibernate-entitymanager - - - - io.springfox - springfox-swagger2 - 2.9.2 - - - io.springfox - springfox-swagger-ui - 2.9.2 - - + org.springframework.boot spring-boot-starter-test diff --git a/spring-boot-configuration/src/main/java/com/baeldung/Application.java b/spring-boot-bootstrap/spring-boot-configuration/src/main/java/com/baeldung/Application.java similarity index 75% rename from spring-boot-configuration/src/main/java/com/baeldung/Application.java rename to spring-boot-bootstrap/spring-boot-configuration/src/main/java/com/baeldung/Application.java index 019cc5b57c..7021ae62fa 100644 --- a/spring-boot-configuration/src/main/java/com/baeldung/Application.java +++ b/spring-boot-bootstrap/spring-boot-configuration/src/main/java/com/baeldung/Application.java @@ -1,20 +1,25 @@ package com.baeldung; +import com.baeldung.service.PersonService; import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringBootConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Import; @EnableAutoConfiguration @ComponentScan(basePackages = {"com.baeldung.*"}) @SpringBootConfiguration -@Import({SwaggerConfig.class}) public class Application { public static void main(String[] args) { - SpringApplication.run(Application.class, args); } + + @Bean + public PersonService personService() { + return new PersonService(); + } } diff --git a/spring-boot-configuration/src/main/java/com/baeldung/controller/PersonController.java b/spring-boot-bootstrap/spring-boot-configuration/src/main/java/com/baeldung/controller/PersonController.java similarity index 100% rename from spring-boot-configuration/src/main/java/com/baeldung/controller/PersonController.java rename to spring-boot-bootstrap/spring-boot-configuration/src/main/java/com/baeldung/controller/PersonController.java diff --git a/spring-boot-configuration/src/main/java/com/baeldung/domain/Person.java b/spring-boot-bootstrap/spring-boot-configuration/src/main/java/com/baeldung/domain/Person.java similarity index 100% rename from spring-boot-configuration/src/main/java/com/baeldung/domain/Person.java rename to spring-boot-bootstrap/spring-boot-configuration/src/main/java/com/baeldung/domain/Person.java diff --git a/spring-boot-configuration/src/main/java/com/baeldung/exception/PersonNotFoundException.java b/spring-boot-bootstrap/spring-boot-configuration/src/main/java/com/baeldung/exception/PersonNotFoundException.java similarity index 100% rename from spring-boot-configuration/src/main/java/com/baeldung/exception/PersonNotFoundException.java rename to spring-boot-bootstrap/spring-boot-configuration/src/main/java/com/baeldung/exception/PersonNotFoundException.java diff --git a/spring-boot-configuration/src/main/java/com/baeldung/repository/PersonRepository.java b/spring-boot-bootstrap/spring-boot-configuration/src/main/java/com/baeldung/repository/PersonRepository.java similarity index 100% rename from spring-boot-configuration/src/main/java/com/baeldung/repository/PersonRepository.java rename to spring-boot-bootstrap/spring-boot-configuration/src/main/java/com/baeldung/repository/PersonRepository.java diff --git a/spring-boot-configuration/src/main/java/com/baeldung/service/PersonService.java b/spring-boot-bootstrap/spring-boot-configuration/src/main/java/com/baeldung/service/PersonService.java similarity index 98% rename from spring-boot-configuration/src/main/java/com/baeldung/service/PersonService.java rename to spring-boot-bootstrap/spring-boot-configuration/src/main/java/com/baeldung/service/PersonService.java index e5929177de..74f7cb0a70 100644 --- a/spring-boot-configuration/src/main/java/com/baeldung/service/PersonService.java +++ b/spring-boot-bootstrap/spring-boot-configuration/src/main/java/com/baeldung/service/PersonService.java @@ -9,7 +9,7 @@ import org.springframework.stereotype.Service; import java.util.List; import java.util.Optional; -@Service +//@Service public class PersonService { @Autowired diff --git a/spring-boot-configuration/src/main/resources/application.properties b/spring-boot-bootstrap/spring-boot-configuration/src/main/resources/application.properties similarity index 100% rename from spring-boot-configuration/src/main/resources/application.properties rename to spring-boot-bootstrap/spring-boot-configuration/src/main/resources/application.properties diff --git a/spring-boot-configuration/src/main/resources/schema.sql b/spring-boot-bootstrap/spring-boot-configuration/src/main/resources/schema.sql similarity index 100% rename from spring-boot-configuration/src/main/resources/schema.sql rename to spring-boot-bootstrap/spring-boot-configuration/src/main/resources/schema.sql diff --git a/spring-boot-configuration/src/test/java/com/baeldung/ApplicationTests.java b/spring-boot-bootstrap/spring-boot-configuration/src/test/java/com/baeldung/ApplicationTests.java similarity index 100% rename from spring-boot-configuration/src/test/java/com/baeldung/ApplicationTests.java rename to spring-boot-bootstrap/spring-boot-configuration/src/test/java/com/baeldung/ApplicationTests.java diff --git a/spring-boot-configuration/.gitignore b/spring-boot-configuration/.gitignore deleted file mode 100644 index a2a3040aa8..0000000000 --- a/spring-boot-configuration/.gitignore +++ /dev/null @@ -1,31 +0,0 @@ -HELP.md -target/ -!.mvn/wrapper/maven-wrapper.jar -!**/src/main/** -!**/src/test/** - -### STS ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans -.sts4-cache - -### IntelliJ IDEA ### -.idea -*.iws -*.iml -*.ipr - -### NetBeans ### -/nbproject/private/ -/nbbuild/ -/dist/ -/nbdist/ -/.nb-gradle/ -build/ - -### VS Code ### -.vscode/ diff --git a/spring-boot-configuration/src/main/java/com/baeldung/SwaggerConfig.java b/spring-boot-configuration/src/main/java/com/baeldung/SwaggerConfig.java deleted file mode 100644 index c69e65bc4e..0000000000 --- a/spring-boot-configuration/src/main/java/com/baeldung/SwaggerConfig.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.baeldung; - -import org.springframework.boot.SpringBootConfiguration; -import org.springframework.context.annotation.Bean; -import springfox.documentation.builders.PathSelectors; -import springfox.documentation.builders.RequestHandlerSelectors; -import springfox.documentation.spi.DocumentationType; -import springfox.documentation.spring.web.plugins.Docket; -import springfox.documentation.swagger2.annotations.EnableSwagger2; - -@SpringBootConfiguration -@EnableSwagger2 -public class SwaggerConfig { - @Bean - public Docket api() { - return new Docket(DocumentationType.SWAGGER_2) - .select() - .apis(RequestHandlerSelectors.any()) - .paths(PathSelectors.any()) - .build(); - } -}