title: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): db.UserMapper.xxx
body: <p>Facing exception while running a DROPWIZARD application</p>
  
  <p>ERROR [2016-12-30 04:36:34,735] io.dropwizard.jersey.errors.LoggingExceptionMapper: Error handling a request: 6813de3aa499e307
  ! org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): db.UserMapper.</p>
  
  <pre><code>@Path("/user/{username}")
   public class ExampleResource {
  
   private final SqlSessionFactory sessionFactory;
  
      public ExampleResource(SqlSessionFactory sessionFactory) {
          this.sessionFactory = sessionFactory;
      }
  
      @GET
      public User getUser(@PathParam("username") String username) {
  
          try (SqlSession session = sessionFactory.openSession()) 
          {
             UserMapper users = session.getMapper(UserMapper.class);
              //session.getConfiguration().addMapper(UserMapper.class);
              //UserMapper users = session.getMapper(UserMapper.class);
              return users.findByUsername(username);
          }
  
      }
  }
  </code></pre>
  
  <p>UserMapper.xml </p>
  
  <pre><code>&lt;mapper namespace="db.UserMapper" class="db.UserMapper"&gt;
  &lt;select id="findByUsername" resultType="User"&gt;
  &lt;![CDATA[
      select username,email
      from user
      where username = #{username}
  ]]&gt;
  &lt;/select&gt;
  
  &lt;resultMap id="User" type="core.User"&gt;
      &lt;id column="username" property="username" /&gt;
      &lt;result column="email" property="email" /&gt;
  &lt;/resultMap&gt;
  
  &lt;insert id="addUser"&gt;
  &lt;![CDATA[
      insert into user (username, email)
      values (#{User.username}, #{User.email})
  ]]&gt;
  &lt;/insert&gt;
  </code></pre>
  
  <p></p>
  
  <pre><code>user mapper.java
  
  public interface UserMapper {
  
   User findByUsername(@Param("username") String username);
  
      void addUser(@Param("user") User user);
  }
  </code></pre>
  
  <p>ConfigurationClass:</p>
  
  <pre><code>@Valid
  @NotNull    
  
  private DataSourceFactory datasourceFactory = new DataSourceFactory();
  
  @JsonProperty("database")
  public DataSourceFactory getDataSourceFactory() {
          return this.datasourceFactory;
      }
  public void setDatabase(DataSourceFactory database) {
      this.datasourceFactory = database;
  }
  </code></pre>