Package com.bank.app

Source Code of com.bank.app.TransferScript

package com.bank.app;

import java.util.Random;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import com.bank.config.AppConfig;
import com.bank.domain.InsufficientFundsException;
import com.bank.domain.TransferReceipt;
import com.bank.service.TransferService;

public class TransferScript {

  public static void main(String... args) throws InsufficientFundsException {

    ApplicationContext ctx =
      new AnnotationConfigApplicationContext(AppConfig.class);


    TransferService transferService = ctx.getBean(TransferService.class);

    // generate a random amount between 10.00 and 90.00 dollars
    double amount = (new Random().nextInt(8) + 1) * 10;

    TransferReceipt receipt = transferService.transfer(amount, "A123", "C456");

    System.out.println(receipt);

  }

}
TOP

Related Classes of com.bank.app.TransferScript

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.