This commit is contained in:
smallchill 2017-03-12 14:05:08 +08:00
parent 747e6bdcd0
commit 392e346e7f
4 changed files with 52 additions and 9 deletions

View File

@ -8,7 +8,7 @@
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<ThresholdFilter level="trace" onMatch="ACCEPT" onMismatch="DENY" />
<PatternLayout pattern="%n%date{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%file] %n%level : %msg%n" />
<PatternLayout pattern="%date{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%file] %n%level : %msg%n" />
</Console>
<RollingFile name="RollingFile"
fileName="${logdir}/blade.log"

View File

@ -15,8 +15,6 @@
*/
package com.smallchill.common.config;
import java.math.BigDecimal;
import com.smallchill.common.intercept.DefaultSelectFactory;
import com.smallchill.common.plugins.GlobalPlugin;
import com.smallchill.core.config.IConfig;
@ -28,10 +26,11 @@ import com.smallchill.core.toolbox.cache.EhcacheFactory;
import com.smallchill.core.toolbox.cache.ICache;
import com.smallchill.core.toolbox.file.DefaultFileProxyFactory;
import com.smallchill.core.toolbox.grid.JqGridFactory;
import com.smallchill.core.toolbox.kit.DateKit;
import com.smallchill.core.toolbox.kit.Prop;
import com.smallchill.core.toolbox.kit.PropKit;
import java.math.BigDecimal;
public class WebConfig implements IConfig {
/**
@ -100,7 +99,7 @@ public class WebConfig implements IConfig {
* 工程启动完毕执行逻辑
*/
public void afterBladeStart() {
System.out.println(DateKit.getMsTime() + " after blade start, you can do something~~~~~~~~~~~~~~~~");
}
/**

View File

@ -15,17 +15,17 @@
*/
package com.smallchill.core.listener;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;
import com.smallchill.core.config.BladeConfig;
import com.smallchill.core.constant.Cst;
import com.smallchill.core.plugins.IPluginHolder;
import com.smallchill.core.plugins.PluginFactory;
import com.smallchill.core.plugins.PluginManager;
import com.smallchill.core.plugins.connection.LogoPlugin;
import com.smallchill.core.plugins.connection.RedisPlugin;
import com.smallchill.core.plugins.connection.SQLManagerPlugin;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;
/**
* 启动监听器
@ -57,6 +57,7 @@ public class StartupListener implements ApplicationListener<ContextRefreshedEven
IPluginHolder plugins = PluginFactory.init();
plugins.register(SQLManagerPlugin.init());
plugins.register(RedisPlugin.init());
plugins.register(new LogoPlugin());
BladeConfig.getConf().registerPlugins(plugins);//自定义配置插件
PluginManager.init().start();
}

View File

@ -0,0 +1,43 @@
/**
* Copyright (c) 2015-2017, Chill Zhuang 庄骞 (smallchill@163.com).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.smallchill.core.plugins.connection;
import com.smallchill.core.plugins.IPlugin;
public class LogoPlugin implements IPlugin {
public void start() {
printLogo();
}
public void stop() {
printLogo();
}
public void printLogo() {
StringBuilder sb = new StringBuilder();
sb.append(" _____ _ ______ _ _\n");
sb.append("/ ___| (_) | ___ \\| | | |\n");
sb.append("\\ `--. _ __ _ __ _ _ __ __ _ | |_/ /| | __ _ __| | ___\n");
sb.append(" `--. \\| '_ \\ | '__|| || '_ \\ / _` | | ___ \\| | / _` | / _` | / _ \\\n");
sb.append("/\\__/ /| |_) || | | || | | || (_| | | |_/ /| || (_| || (_| || __/\n");
sb.append("\\____/ | .__/ |_| |_||_| |_| \\__, | \\____/ |_| \\__,_| \\__,_| \\___|\n");
sb.append(" | | __/ |\n");
sb.append(" |_| |___/");
System.out.println(sb.toString());
}
}