change package name
This commit is contained in:
@@ -1,12 +0,0 @@
|
||||
package com.instana.robotshop;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.data.repository.PagingAndSortingRepository;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
|
||||
|
||||
@RepositoryRestResource(collectionResourceRel = "cities", path = "city")
|
||||
public interface CityRepository extends PagingAndSortingRepository<City, Long> {
|
||||
List<City> findByCode(@Param("code") String code);
|
||||
}
|
@@ -1,11 +0,0 @@
|
||||
package com.instana.robotshop;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class ShippingApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(ShippingApplication.class, args);
|
||||
}
|
||||
}
|
@@ -1,4 +1,4 @@
|
||||
package com.instana.robotshop;
|
||||
package com.instana.robotshop.shipping;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
@@ -69,4 +69,9 @@ public class City {
|
||||
public void setLongitude(double longitude) {
|
||||
this.longitude = longitude;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("Country: %s City: %s Region: %s Coords: %f %f", this.code, this.city, this.region, this.latitude, this.longitude);
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
package com.instana.robotshop.shipping;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
|
||||
public interface CityRepository extends CrudRepository<City, Long> {
|
||||
List<City> findByCode(String code);
|
||||
|
||||
City findById(long id);
|
||||
}
|
@@ -0,0 +1,22 @@
|
||||
package com.instana.robotshop.shipping;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
public class Controller {
|
||||
private static final Logger logger = LoggerFactory.getLogger(Controller.class);
|
||||
|
||||
@GetMapping("/cities")
|
||||
public List<City> cities(@RequestParam(value = "code") String code) {
|
||||
logger.info("cities by code {}", code);
|
||||
|
||||
return new <City>ArrayList();
|
||||
}
|
||||
}
|
@@ -1,4 +1,4 @@
|
||||
package com.instana.robotshop;
|
||||
package com.instana.robotshop.shipping;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
@@ -0,0 +1,13 @@
|
||||
package com.instana.robotshop.shipping;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class ShippingServiceApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(ShippingServiceApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
1
shipping/src/main/resources/application.properties
Normal file
1
shipping/src/main/resources/application.properties
Normal file
@@ -0,0 +1 @@
|
||||
|
Reference in New Issue
Block a user