mirror of
https://gitee.com/nutz/nutzboot.git
synced 2024-11-29 18:28:01 +08:00
update: 既然要简单,那就把nutzboot-demo-simple最简化
This commit is contained in:
parent
0a5310cc1b
commit
ef0337c467
@ -0,0 +1,21 @@
|
||||
package io.nutz.demo.simple;
|
||||
|
||||
import org.nutz.boot.NbApp;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
@IocBean
|
||||
public class MainLauncher {
|
||||
|
||||
@Ok("raw")
|
||||
@At("/time/now")
|
||||
public long now() {
|
||||
return System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
new NbApp(MainLauncher.class).run();
|
||||
}
|
||||
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
package io.nutz.demo.simple;
|
||||
|
||||
import org.nutz.boot.NbApp;
|
||||
|
||||
public class MainModule {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
new NbApp().setMainClass(MainModule.class).setArgs(args).setAllowCommandLineProperties(true).run();
|
||||
}
|
||||
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
package io.nutz.demo.simple;
|
||||
|
||||
import org.nutz.log.Log;
|
||||
import org.nutz.log.Logs;
|
||||
import org.nutz.mvc.NutConfig;
|
||||
import org.nutz.mvc.Setup;
|
||||
|
||||
public class MainSetup implements Setup {
|
||||
|
||||
private static final Log log = Logs.get();
|
||||
|
||||
public void init(NutConfig nc) {
|
||||
log.info("Hello, So NB!");
|
||||
}
|
||||
|
||||
public void destroy(NutConfig nc) {
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
package io.nutz.demo.simple.module;
|
||||
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
|
||||
@IocBean
|
||||
@At("/time")
|
||||
public class TimeModule {
|
||||
|
||||
@Ok("raw")
|
||||
@At
|
||||
public long now() {
|
||||
return System.currentTimeMillis();
|
||||
}
|
||||
}
|
@ -1,16 +1,5 @@
|
||||
log4j.rootLogger=debug,Console
|
||||
|
||||
log4j.logger.org.apache.commons.beanutils=info
|
||||
log4j.logger.org.quartz.core.QuartzSchedulerThread=info
|
||||
log4j.logger.org.apache.shiro.web=debug
|
||||
log4j.logger.org.snaker.engine.access.transaction.TransactionInterceptor=info
|
||||
log4j.logger.net.sf.ehcache.statistics=info
|
||||
log4j.logger.io.netty.util.internal=info
|
||||
log4j.logger.net.sf.ehcache.store.disk.Segment=info
|
||||
log4j.logger.io.netty.handler.codec=info
|
||||
log4j.logger.com.corundumstudio.socketio=info
|
||||
log4j.logger.org.apache.shiro.mgt=info
|
||||
log4j.logger.org.apache.shiro.web.servlet.SimpleCookie=info
|
||||
log4j.logger.org.eclipse.jetty=info
|
||||
|
||||
log4j.appender.Console=org.apache.log4j.ConsoleAppender
|
||||
|
@ -42,6 +42,13 @@ public class NbApp {
|
||||
|
||||
protected AppContext ctx;
|
||||
|
||||
public NbApp() {
|
||||
}
|
||||
|
||||
public NbApp(Class<?> mainClass) {
|
||||
this.mainClass = mainClass;
|
||||
}
|
||||
|
||||
public NbApp setArgs(String[] args) {
|
||||
this.args = args;
|
||||
return this;
|
||||
|
Loading…
Reference in New Issue
Block a user