Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 7bf7572

Browse files
Piyush ChaudhariPiyush Chaudhari
Piyush Chaudhari
authored and
Piyush Chaudhari
committed
save country
1 parent 5d27bbb commit 7bf7572

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

‎src/main/java/com/ehcache/example/controller/CountryController.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@
88
import org.springframework.beans.factory.annotation.Autowired;
99
import org.springframework.http.HttpStatus;
1010
import org.springframework.http.ResponseEntity;
11+
import org.springframework.web.bind.annotation.RequestBody;
1112
import org.springframework.web.bind.annotation.RequestMapping;
1213
import org.springframework.web.bind.annotation.RequestMethod;
1314
import org.springframework.web.bind.annotation.RestController;
1415

16+
import com.ehcache.example.entity.Country;
1517
import com.ehcache.example.service.CountryService;
1618

1719
@RestController
@@ -29,4 +31,12 @@ public ResponseEntity<Object> list(){
2931
resultMap.put("countryList", countryService.list());
3032
return new ResponseEntity<>(resultMap, HttpStatus.OK);
3133
}
34+
35+
@RequestMapping(value="/create",method=RequestMethod.POST)
36+
public ResponseEntity<Object> create(@RequestBody Country country){
37+
Map<String, Object> resultMap = new HashMap<>();
38+
logger.info("create:> {} ",country);
39+
resultMap.put("country", countryService.save(country));
40+
return new ResponseEntity<>(resultMap, HttpStatus.OK);
41+
}
3242
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /