diff --git a/spring-boot-mvc/src/main/java/com/baeldung/swaggerboot/Application.java b/spring-boot-mvc/src/main/java/com/baeldung/swaggerboot/Application.java index 2161597c4e..14e46b2306 100644 --- a/spring-boot-mvc/src/main/java/com/baeldung/swaggerboot/Application.java +++ b/spring-boot-mvc/src/main/java/com/baeldung/swaggerboot/Application.java @@ -2,10 +2,8 @@ package com.baeldung.swaggerboot; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.ComponentScan; @SpringBootApplication -@ComponentScan(basePackages = {"com.baeldung"}) public class Application { public static void main(String[] args) { diff --git a/spring-boot-mvc/src/main/java/com/baeldung/swaggerboot/Constants.java b/spring-boot-mvc/src/main/java/com/baeldung/swaggerboot/Constants.java deleted file mode 100644 index 14b4162713..0000000000 --- a/spring-boot-mvc/src/main/java/com/baeldung/swaggerboot/Constants.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.baeldung.swaggerboot; - -public class Constants { - - public static final String DEFAULT_GREETING = "Howdy Cosmic Spheroid!"; - public static final String DEFAULT_ERROR = "Fail!"; - - /** - * API Endpoint. - */ - - public static final String REACTIVE_REST_URL = "/reactiverest"; - public static final String FUNCTIONAL_URL = "/functional"; - public static final String REGULAR_REST_URL = "/regularrest"; - -} \ No newline at end of file diff --git a/spring-boot-mvc/src/main/java/com/baeldung/swaggerboot/configuration/SpringFoxConfig.java b/spring-boot-mvc/src/main/java/com/baeldung/swaggerboot/configuration/SpringFoxConfig.java index babe70580c..3041dfdcc8 100644 --- a/spring-boot-mvc/src/main/java/com/baeldung/swaggerboot/configuration/SpringFoxConfig.java +++ b/spring-boot-mvc/src/main/java/com/baeldung/swaggerboot/configuration/SpringFoxConfig.java @@ -1,7 +1,5 @@ package com.baeldung.swaggerboot.configuration; -import com.fasterxml.classmate.TypeResolver; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @@ -21,9 +19,6 @@ import java.util.Collections; @ComponentScan("com.baeldung.swaggerboot.controller") public class SpringFoxConfig { - @Autowired - private TypeResolver typeResolver; - private ApiInfo apiInfo() { return new ApiInfo( "My REST API", diff --git a/spring-boot-mvc/src/main/java/com/baeldung/swaggerboot/controller/RegularRestController.java b/spring-boot-mvc/src/main/java/com/baeldung/swaggerboot/controller/RegularRestController.java index 537e16d146..676937f7d7 100644 --- a/spring-boot-mvc/src/main/java/com/baeldung/swaggerboot/controller/RegularRestController.java +++ b/spring-boot-mvc/src/main/java/com/baeldung/swaggerboot/controller/RegularRestController.java @@ -1,22 +1,14 @@ package com.baeldung.swaggerboot.controller; -import com.baeldung.swaggerboot.services.RegularWebService; -import com.baeldung.swaggerboot.transfer.CustomResponse; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; -import static com.baeldung.swaggerboot.Constants.REGULAR_REST_URL; - @RestController public class RegularRestController { - @Autowired - RegularWebService regularWebService; - - @GetMapping(REGULAR_REST_URL) - public CustomResponse getSession() { - return regularWebService.example(); + @GetMapping("home") + public String getSession() { + return "Hello"; } } \ No newline at end of file diff --git a/spring-boot-mvc/src/main/java/com/baeldung/swaggerboot/services/RegularWebService.java b/spring-boot-mvc/src/main/java/com/baeldung/swaggerboot/services/RegularWebService.java deleted file mode 100644 index d13ed7a6a9..0000000000 --- a/spring-boot-mvc/src/main/java/com/baeldung/swaggerboot/services/RegularWebService.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.baeldung.swaggerboot.services; - -import com.baeldung.swaggerboot.transfer.CustomResponse; -import org.springframework.stereotype.Service; - -import static com.baeldung.swaggerboot.Constants.DEFAULT_ERROR; -import static com.baeldung.swaggerboot.Constants.DEFAULT_GREETING; - -@Service -public class RegularWebService { - - public CustomResponse example() { - try { - return new CustomResponse(0, DEFAULT_GREETING); - } catch (Exception ex) { - return new CustomResponse(0, DEFAULT_ERROR); - } - } - -} \ No newline at end of file diff --git a/spring-boot-mvc/src/main/java/com/baeldung/swaggerboot/transfer/CustomResponse.java b/spring-boot-mvc/src/main/java/com/baeldung/swaggerboot/transfer/CustomResponse.java deleted file mode 100644 index d09e9f935e..0000000000 --- a/spring-boot-mvc/src/main/java/com/baeldung/swaggerboot/transfer/CustomResponse.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.baeldung.swaggerboot.transfer; - -public class CustomResponse { - - private int id; - private String note; - - public CustomResponse() {} - - public CustomResponse(int id, String note) { - this.id = id; - this.note = note; - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getNote() { - return note; - } - - public void setNote(String note) { - this.note = note; - } - -} diff --git a/spring-boot-mvc/src/main/resources/application.properties b/spring-boot-mvc/src/main/resources/application.properties index e69de29bb2..709574239b 100644 --- a/spring-boot-mvc/src/main/resources/application.properties +++ b/spring-boot-mvc/src/main/resources/application.properties @@ -0,0 +1 @@ +spring.main.allow-bean-definition-overriding=true \ No newline at end of file