Ai
8 Star 303 Fork 18

smartboot/Feat

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
FeatApp.java 1.60 KB
一键复制 编辑 原始数据 按行查看 历史
三刀 提交于 2025-07-31 18:47 +08:00 . feat-test: 添加启动时间打印功能
/*
* Copyright (C) [2024] smartboot [zhengjunweimail@163.com]
*
* 企业用户未经smartboot组织特别许可,需遵循AGPL-3.0开源协议合理合法使用本项目。
*
* Enterprise users are required to use this project reasonably
* and legally in accordance with the AGPL-3.0 open source agreement
* without special permission from the smartboot organization.
*/
package tech.smartboot.feat.demo.benchmark;
import tech.smartboot.feat.cloud.FeatCloud;
import tech.smartboot.feat.cloud.annotation.Controller;
import tech.smartboot.feat.cloud.annotation.RequestMapping;
import tech.smartboot.feat.core.common.HeaderValue;
import tech.smartboot.feat.core.server.HttpResponse;
/**
* @author 三刀 zhengjunweimail@163.com
* @version v1.0.0
*/
@Controller
public class FeatApp {
@RequestMapping("/hello")
public String plaintext(HttpResponse response) {
response.setContentType(HeaderValue.ContentType.TEXT_PLAIN_UTF8);
return "Hello World!";
}
@RequestMapping("/json")
public Response json(HttpResponse response) {
response.setContentType(HeaderValue.ContentType.APPLICATION_JSON_UTF8);
return new Response("Hello", "World");
}
public static void main(String[] args) {
long start = System.currentTimeMillis();
// 定义服务器接受的消息类型以及各类消息对应的处理器
FeatCloud.cloudServer(options -> {
options
.setPackages("tech.smartboot.feat.demo.benchmark");
}).listen(8082);
System.out.println("启动耗时:" + (System.currentTimeMillis() - start));
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/smartboot/feat.git
git@gitee.com:smartboot/feat.git
smartboot
feat
Feat
master

搜索帮助