package cn.sina.credit;
import cn.sina.credit.payment.czbank.CZPay;
import cn.sina.credit.payment.czbank.common.CZBankClient;
import cn.sina.credit.service.AddressManagerService;
import cn.sina.credit.service.CustomerService;
import cn.sina.credit.service.ListManagerService;
import cn.sina.credit.service.PaymentService;
import cn.sina.credit.utils.HttpHelper;
import com.google.inject.AbstractModule;
import com.google.inject.Scopes;
public class ServiceModule extends AbstractModule{
@Override
protected void configure() {
bind(PaymentService.class);
bind(CZPay.class);
bind(CZBankClient.class).in(Scopes.SINGLETON);
bind(HttpHelper.class).in(Scopes.SINGLETON);
bind(CustomerService.class).in(Scopes.NO_SCOPE);
bind(ListManagerService.class).in(Scopes.NO_SCOPE);
bind(AddressManagerService.class).in(Scopes.NO_SCOPE);
}
}
================
public class PersistModule extends MyBatisModule {
protected void initialize() {
bindDataSourceProviderType(C3p0DataSourceProvider.class);
bindTransactionFactoryType(JdbcTransactionFactory.class);
//bind mappers here
addMapperClass(PaymentSignMapper.class);
addMapperClass(PaymentTransactionMapper.class);
addMapperClass(ContractMapper.class);
addMapperClass(ReportMapper.class);
//注册用户黑名单,灰名单Mapper
addMapperClass(BlackListMapper.class);
addMapperClass(GreyListMapper.class);
//注册 地址黑名单,灰名单Mapper
addMapperClass(BlackAddressMapper.class);
addMapperClass(GreyAddressMapper.class);
Names.bindProperties(binder(), createProperties());
addDestroyHook();
}
========================
@Override
protected Injector getInjector() {
injector = Guice.createInjector(new Struts2GuicePluginModule(),
new AbstractModule() {
@Override
protected void configure() {
bind(Configuration.class).toProvider(
ConfigurationProvider.class).in(
Scopes.SINGLETON);
bind(HttpHelper.class).in(Scopes.SINGLETON);
}
}, new FilterModule(),new PersistModule());
sidebar.jsp
struct.xml文件:
/WEB-INF/fraud/blacklist.ftl
/WEB-INF/fraud/blacklist.ftl
method="addBlackList">
/WEB-INF/fraud/blacklist.ftl
method="updateBlackList1">
/WEB-INF/fraud/blacklist.ftl
dbproperties
mybatis.environment.id = mybatis_env
JDBC.driver=oracle.jdbc.OracleDriver
JDBC.url=jdbc:oracle:thin:@139.196.104.87:1521:sinafq
JDBC.username=sina_credit
JDBC.password=test110
JDBC.autoCommit=true
c3p0.maxPoolSize=20
c3p0.minPoolSize=5
c3p0.acquireIncrement=2
c3p0.maxIdleTime=1800
c3p0.idleConnectionTestPeriod=60
c3p0.testConnectionOnCheckout = false
c3p0.testConnectionOnCheckin = true
#client will wait 30s to get a connection
c3p0.checkoutTimeout=30000
c3p0.maxAdministrativeTaskTime = 600
ApplicationResoures_zh.property
title.fraud.blacklist =\u540d\u5355\u7ba1\u7406