1 Star 0 Fork 953

jlcoding/jboot

forked from JbootProjects/jboot 
加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
ControllerTest.java 1.52 KB
一键复制 编辑 原始数据 按行查看 历史
Michael Yang 提交于 2017-12-14 12:00 +08:00 . restructure JbootDirectiveBase
import com.jfinal.core.Controller;
import io.jboot.Jboot;
import io.jboot.aop.annotation.Bean;
import io.jboot.core.cache.annotation.Cacheable;
import io.jboot.web.controller.annotation.RequestMapping;
import javax.inject.Inject;
import javax.inject.Singleton;
@RequestMapping("/test")
public class ControllerTest extends Controller {
public static void main(String[] args) {
// Jboot.setBootArg("jboot.hystrix.url", "/hystrix.stream");
// Jboot.setBootArg("jboot.cache.type", "redis");
// Jboot.setBootArg("jboot.metrics.url", "/metrics.abc");
// Jboot.setBootArg("jboot.cache.redis.host", "127.0.0.1");
Jboot.run(args);
}
public void json() {
setAttr("aaa", "bbb");
renderJson();
}
@Inject
ServiceInter serviceTest;
public void index() {
renderText("hello" + serviceTest.hello(""));
}
public void directive() {
render("/test.html");
}
public void directive1() {
render("/test1.html");
}
@Singleton
@Bean
public static class ServiceTest implements ServiceInter {
@Override
@Cacheable(name = "aaa", key = "#(\"key:\" + aaa)")
public String hello(String aaa) {
System.out.println("hello invoked");
return "hello " + aaa;
}
@Override
public String test1() {
return null;
}
}
public static interface ServiceInter {
public String hello(String aaa);
public String test1();
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/msgcode/jboot.git
git@gitee.com:msgcode/jboot.git
msgcode
jboot
jboot
master

搜索帮助