Commit 17d0436f authored by Ashok Kumar K's avatar Ashok Kumar K

externalized config and changed url mapping for ProductController

parent 12ea6ed8
...@@ -18,13 +18,20 @@ repositories { ...@@ -18,13 +18,20 @@ repositories {
mavenCentral() mavenCentral()
} }
ext {
set('springCloudVersion', "Hoxton.SR4")
}
dependencies { dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-mongodb' implementation 'org.springframework.boot:spring-boot-starter-data-mongodb'
implementation 'org.springframework.boot:spring-boot-starter-validation' implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.cloud:spring-cloud-starter-config'
implementation 'org.springframework.boot:spring-boot-starter-actuator' implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-client'
// implementation 'org.springframework.cloud:spring-cloud-starter-openfeign'
compileOnly 'org.projectlombok:lombok' compileOnly 'org.projectlombok:lombok'
developmentOnly 'org.springframework.boot:spring-boot-devtools' // developmentOnly 'org.springframework.boot:spring-boot-devtools'
annotationProcessor 'org.projectlombok:lombok' annotationProcessor 'org.projectlombok:lombok'
compile "io.springfox:springfox-swagger2:2.9.2" compile "io.springfox:springfox-swagger2:2.9.2"
compile "io.springfox:springfox-swagger-ui:2.9.2" compile "io.springfox:springfox-swagger-ui:2.9.2"
...@@ -33,6 +40,12 @@ dependencies { ...@@ -33,6 +40,12 @@ dependencies {
} }
} }
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
}
test { test {
useJUnitPlatform() useJUnitPlatform()
} }
...@@ -4,6 +4,7 @@ import org.springframework.boot.SpringApplication; ...@@ -4,6 +4,7 @@ import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication @SpringBootApplication
public class EcomProductApplication { public class EcomProductApplication {
public static void main(String[] args) { public static void main(String[] args) {
......
...@@ -3,6 +3,7 @@ package com.nisum.ecomproduct.controller; ...@@ -3,6 +3,7 @@ package com.nisum.ecomproduct.controller;
import com.nisum.ecomproduct.model.Product; import com.nisum.ecomproduct.model.Product;
import com.nisum.ecomproduct.service.ProductService; import com.nisum.ecomproduct.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
...@@ -11,8 +12,8 @@ import org.springframework.web.bind.annotation.*; ...@@ -11,8 +12,8 @@ import org.springframework.web.bind.annotation.*;
import javax.validation.Valid; import javax.validation.Valid;
import java.util.List; import java.util.List;
@RefreshScope
@RestController @RestController
@RequestMapping("product")
@Validated @Validated
public class ProductController { public class ProductController {
......
spring:
data:
mongodb:
host: localhost
port: 27017
database: ecom
logging:
level:
web: debug
\ No newline at end of file
server: server:
port: 8011 port: 8011
spring:
profiles:
active: development
data:
mongodb:
host: localhost
port: 27017
database: ecom
management:
endpoints:
web:
exposure:
include: '*'
spring: spring:
application: application:
name: ecom-product name: ecom-product
\ No newline at end of file profiles:
active: development
cloud:
config:
uri: http://localhost:8888
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment