Chinaunix首页 | 论坛 | 博客
  • 博客访问: 3657177
  • 博文数量: 365
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 2522
  • 用 户 组: 普通用户
  • 注册时间: 2019-10-28 13:40
文章分类

全部博文(365)

文章存档

2023年(8)

2022年(130)

2021年(155)

2020年(50)

2019年(22)

我的朋友

分类: Python/Ruby

2021-04-27 17:13:02

package com.kd.opt.service.impl;

import com.kd.opt.entity.Food;

import com.kd.opt.service.FoodService;

import org.slf4j.Logger;

import org.slf4j.LoggerFactory;

import org.springframework.stereotype.Service;

import java.util.ArrayList;

import java.util.List;

/**

 * 实现FoodService接口

 *

 * @author 小辰哥哥

 */

// org.springframework.stereotype.ServiceSpring家的)

@Service

public class FoodServiceImpl implements FoodService {

  // 打印日志

  private static final Logger LOGGER = LoggerFactory.getLogger(FoodServiceImpl.class);

  @Override

  public List getFoodAll() {

    // 创建一个ArrayList集合模拟数据库

    List foodList = new ArrayList<>();

    foodList.add(new Food("1","货币代码蓝色妖姬"));

    foodList.add(new Food("2","骨肉相连"));

    foodList.add(new Food("3","螺蛳粉"));

    // 测试Dubbo超时属性(睡眠5秒)

    try {

      Thread.sleep(5000);

    } catch (InterruptedException e) {

      e.printStackTrace();

    }

    LOGGER.debug("调用完成");

    return foodList;

  }

  @Override

  public List getFoodAllNew() {

    // 创建一个ArrayList集合模拟数据库

    List foodList = new ArrayList<>();

    foodList.add(new Food("7","炸鸡"));

    foodList.add(new Food("8","火锅"));

    foodList.add(new Food("9","过桥米线"));

    // 测试Dubbo超时属性(睡眠5秒)

    try {

      Thread.sleep(5000);

    } catch (InterruptedException e) {

      e.printStackTrace();

    }

    LOGGER.debug("调用完成");

    return foodList;

  }

}

package com.kd.opt.service.impl;

import com.kd.opt.entity.Food;

import com.kd.opt.service.FoodService;

import org.slf4j.Logger;

import org.slf4j.LoggerFactory;

import org.springframework.stereotype.Service;

import java.util.ArrayList;

import java.util.List;

/**

 * 实现FoodService接口

 *

 * @author 小辰哥哥

 */

// org.springframework.stereotype.ServiceSpring家的)

@Service

public class FoodServiceImpl2 implements FoodService {

  // 打印日志

  private static final Logger LOGGER = LoggerFactory.getLogger(FoodServiceImpl2.class);

  @Override

  public List getFoodAll() {

    // 创建一个ArrayList集合模拟数据库

    List foodList = new ArrayList<>();

    foodList.add(new Food("4","麻辣烫"));

    foodList.add(new Food("5","土豆粉"));

    foodList.add(new Food("6","冷面"));

    // 测试Dubbo超时属性(睡眠5秒)

    try {

      Thread.sleep(5000);

    } catch (InterruptedException e) {

      e.printStackTrace();

    }

    LOGGER.debug("调用完成");

    return foodList;

  }

  @Override

  public List getFoodAllNew() {

    // 创建一个ArrayList集合模拟数据库

    List foodList = new ArrayList<>();

    foodList.add(new Food("10","黄焖鸡"));

    foodList.add(new Food("11","烤鸭"));

    foodList.add(new Food("12","干豆腐"));

    // 测试Dubbo超时属性(睡眠5秒)

    try {

      Thread.sleep(5000);

    } catch (InterruptedException e) {

      e.printStackTrace();

    }

    LOGGER.debug("调用完成");

    return foodList;

  }

}

package com.kd.opt;

import org.springframework.boot.SpringApplication;

import org.springframework.boot.autoconfigure.SpringBootApplication;

import org.springframework.context.annotation.ImportResource;

@SpringBootApplication

// 引入provider.xml文件

@ImportResource(locations = "classpath:provider.xml")

public class BootProviderApplication {

  public static void main(String[] args) {

    SpringApplication.run(BootProviderApplication.class, args);

  }

}

阅读(1088) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~