Move Mapper binding to GitServletModule

This commit is contained in:
Johannes Schnatterer
2018-08-01 14:11:27 +02:00
parent 02327b55f3
commit 7c8fee5640
2 changed files with 6 additions and 21 deletions

View File

@@ -1,18 +0,0 @@
package sonia.scm.api.v2.resources;
import com.google.inject.AbstractModule;
import com.google.inject.servlet.ServletScopes;
import org.mapstruct.factory.Mappers;
import sonia.scm.plugin.Extension;
@Extension
public class MapperModule extends AbstractModule {
@Override
protected void configure() {
bind(GitConfigDtoToGitConfigMapper.class).to(Mappers.getMapper(GitConfigDtoToGitConfigMapper.class).getClass());
bind(GitConfigToGitConfigDtoMapper.class).to(Mappers.getMapper(GitConfigToGitConfigDtoMapper.class).getClass());
bind(UriInfoStore.class).in(ServletScopes.REQUEST);
}
}

View File

@@ -36,11 +36,11 @@ package sonia.scm.web;
//~--- non-JDK imports --------------------------------------------------------
import com.google.inject.servlet.ServletModule;
import org.eclipse.jgit.transport.ScmTransportProtocol;
import org.mapstruct.factory.Mappers;
import sonia.scm.api.v2.resources.GitConfigDtoToGitConfigMapper;
import sonia.scm.api.v2.resources.GitConfigToGitConfigDtoMapper;
import sonia.scm.plugin.Extension;
import sonia.scm.web.lfs.LfsBlobStoreFactory;
/**
@@ -73,6 +73,9 @@ public class GitServletModule extends ServletModule
bind(LfsBlobStoreFactory.class);
bind(GitConfigDtoToGitConfigMapper.class).to(Mappers.getMapper(GitConfigDtoToGitConfigMapper.class).getClass());
bind(GitConfigToGitConfigDtoMapper.class).to(Mappers.getMapper(GitConfigToGitConfigDtoMapper.class).getClass());
// serlvelts and filters
serve(PATTERN_GIT).with(ScmGitServlet.class);
}