乐趣区

关于python:Apache-Dubbo-框架的使用五

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.Service(Spring 家的)
@Service
public class FoodServiceImpl implements FoodService {
// 打印日志
private static final Logger LOGGER = LoggerFactory.getLogger(FoodServiceImpl.class);
@Override
public List<Food> getFoodAll() {

// 创立一个 ArrayList 汇合模仿数据库
List<Food> 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<Food> getFoodAllNew() {

// 创立一个 ArrayList 汇合模仿数据库
List<Food> 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.Service(Spring 家的)
@Service
public class FoodServiceImpl2 implements FoodService {
// 打印日志
private static final Logger LOGGER = LoggerFactory.getLogger(FoodServiceImpl2.class);
@Override
public List<Food> getFoodAll() {

// 创立一个 ArrayList 汇合模仿数据库
List<Food> 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<Food> getFoodAllNew() {

// [贝宝](https://www.gendan5.com/wallet/PayPal.html) 创立一个 ArrayList 汇合模仿数据库
List<Food> 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);

}
}

退出移动版