This file has been truncated, but you can view the full file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[0.001s][info][arguments] VM Arguments: | |
[0.001s][info][arguments] jvm_args: -Xlog:all=trace | |
[0.001s][info][arguments] java_command: HelloWorld | |
[0.001s][info][arguments] java_class_path (initial): . | |
[0.001s][info][arguments] Launcher Type: SUN_STANDARD | |
[0.001s][info][nmt ] NMT initialized: off | |
[0.001s][info][nmt ] Preinit state: | |
[0.001s][info][nmt ] pre-init mallocs: 577, pre-init reallocs: 0, pre-init frees: 245 | |
[0.001s][info][nmt ] MallocLimit: unset |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7.731s][info][gc,stats ] === Garbage Collection Statistics ======================================================================================================================= | |
[7.731s][info][gc,stats ] Last 10s Last 10m Last 10h Total | |
[7.731s][info][gc,stats ] Avg / Max Avg / Max Avg / Max Avg / Max | |
[7.731s][info][gc,stats ] Contention: Mark Segment Reset Contention 23 / 164 23 / 164 23 / 164 23 / 164 ops/s | |
[7.731s][info][gc,stats ] Contention: Mark SeqNum Reset Contention 0 / 2 0 / 2 0 / 2 0 / 2 ops/s | |
[7.731s][info][gc,stats ] Critical: Allocation Stall 0 / 0 0 / 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-Xlog Usage: -Xlog[:[selections][:[output][:[decorators][:output-options]]]] | |
where 'selections' are combinations of tags and levels of the form tag1[+tag2...][*][=level][,...] | |
NOTE: Unless wildcard (*) is specified, only log messages tagged with exactly the tags specified will be matched. | |
Available log levels: | |
off, trace, debug, info, warning, error | |
Available log decorators: | |
time (t), utctime (utc), uptime (u), timemillis (tm), uptimemillis (um), timenanos (tn), uptimenanos (un), hostname (hn), pid (p), tid (ti), level (l), tags (tg) | |
Decorators can also be specified as 'none' for no decoration. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TestUserService { | |
@Test | |
public void testFindUserExisting() { | |
Map<Long, User> users = new HashMap<>(); | |
users.put(100L, new User(100L, "John", "Doe")); | |
UserService service = new UserService(users, null); | |
User returnedUser = service.findUser(100L); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class UserController { | |
private UserService service; | |
public UserController(UserService service) { | |
this.service = service; | |
} | |
... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ExceptionHandler(ClientException.class) | |
public ResponseEntity<String> clientError(ClientException e) { | |
return ResponseEntity.badRequest().body(e.getMessage()); | |
} | |
@ExceptionHandler(NotFoundException.class) | |
public ResponseEntity<String> resourceNotFound(NotFoundException e) { | |
return ResponseEntity.notFound().build(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Service | |
public class UserService { | |
private List<User> users = new ArrayList<>(); | |
private static final Random ID_GENERATOR = new Random(); | |
public User findUser(long userId) { | |
for(User user : users) { | |
if(user.getId().equals(Long.valueOf(userId))) { | |
return user; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RestController | |
@RequestMapping("/api/v1/users") | |
public class UserController { | |
private UserService service; | |
public UserController(UserService service) { | |
this.service = service; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@GetMapping("/header") | |
public String welcomeUser(@RequestHeader String user) { | |
return String.format("Welcome %s!", user); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@GetMapping("/name") | |
public String helloQueryMessage(@RequestParam String firstName, @RequestParam String lastName) { | |
return String.format("Hello %s %s!", firstName, lastName); | |
} |
NewerOlder