// Path: spring-boot-error-handling/src/main/java/de/chclaus/examples/controller/user/UserDTO.java
// public class UserDTO implements Serializable {
// 
//   private String username;
// 
//   public UserDTO() {
//     // Empty for deserialization
//   }
// 
//   public UserDTO(String username) {
//     this.username = username;
//   }
// 
//   public String getUsername() {
//     return username;
//   }
// 
//   public UserDTO setUsername(String username) {
//     this.username = username;
//     return this;
//   }
// }


import de.chclaus.examples.controller.user.UserDTO;
import org.springframework.stereotype.Service;
package de.chclaus.examples.service.user;


/**
 * Simple service to demonstrate exception handling.
 *
 * @author Christian Claus (ch.claus@me.com)
 */
@Service
public class UserService {

  /**
   * Method to demonstrate a fake user lookup.
   * @param username The username... There is just an admin account.
   * @return a DTO representation of an user.
   */
  public UserDTO findUserByName(String username) {

    // We just have an administrator account. Nothing else. ;)
    if ("admin".equals(username)) {
// Path: spring-boot-error-handling/src/main/java/de/chclaus/examples/controller/user/UserDTO.java
// public class UserDTO implements Serializable {
// 
//   private String username;
// 
//   public UserDTO() {
//     // Empty for deserialization
//   }
// 
//   public UserDTO(String username) {
//     this.username = username;
//   }
// 
//   public String getUsername() {
//     return username;
//   }
// 
//   public UserDTO setUsername(String username) {
//     this.username = username;
//     return this;
//   }
// }


// Path: spring-boot-error-handling/src/main/java/de/chclaus/examples/service/user/UserService.java
import de.chclaus.examples.controller.user.UserDTO;
import org.springframework.stereotype.Service;

package de.chclaus.examples.service.user;


/**
 * Simple service to demonstrate exception handling.
 *
 * @author Christian Claus (ch.claus@me.com)
 */
@Service
public class UserService {

  /**
   * Method to demonstrate a fake user lookup.
   * @param username The username... There is just an admin account.
   * @return a DTO representation of an user.
   */
  public UserDTO findUserByName(String username) {

    // We just have an administrator account. Nothing else. ;)
    if ("admin".equals(username)) {
      return new UserDTO(username);