IDEA+Springboot+JRebel热部署实现

步骤一:在IDEA中安装JRebel插件(File->settings->plugins->search in repositories),如下图

步骤二:安装完成之后,重启idea,破解JRebel插件(可以在help>JRebel>Activaction打开激活页面,也可在重启之后,直接点击右侧指导中进入激活页面)

选择License server方式(url可能失效,可以自行网上搜索)

Url:    http://139.199.89.239:1008/88414687-3b91-4286-89ba-2dc813b107ce

email:随便输入

 jrebel激活之后默认是联网使用的 , 在该模式下 , jrebel会一直联网监测激活信息 . 所以要调为离线使用的,步骤见下图

步骤三:设置IDEA为自动编译

步骤四:按住 Ctrl+Alt+Shift+/ 弹出,  选择Registry后勾选 

步骤五:选择springboot的入口类,右键选择debug with JRebel,等待启动完成即可。

using System;
using System.Threading;
using System.Threading.Tasks;
using System.Net.Http;
namespace Test
{
class Program
{
static void Main(string[] args)
{
var asyncMethod = AccessTheWebAsync(www.michenggw.com);
Console.WriteLine("go on ...... "+ Thread.CurrentThread.ManagedThreadId );
// 等待异步线程处理完毕,没有以下句子,await使控制回到调用方,主线程即终止。
asyncMethod.Wait();
}
public static async Task<int> AccessTheWebAsync()
{
HttpClient client = new HttpClient();
// GetStringAsync returns a Task<string>.
// That means that when you await the task you'll get a string (urlContents).
Task<string> getStringTask www.dfgjpt.com= client.GetStringAsync("http://msdn.microsoft.com");
// You can do work here that doesn't rely on the string from GetStringAsync.
DoIndependentWork(www.jrgjze.com);

// The await operator suspends AccessTheWebAsync.
// - AccessTheWebAsync can't continue until getStringTask is complete.
// - Meanwhile, control returns to the caller of AccessTheWebAsync.
// - Control resumes here when getStringTask is complete.
// - The await operator www.bais7.com then retrieves the string result from getStringTask.

string urlContents = await getStringTask;
Console.WriteLine(urlContents.Length+"....... "+Thread.CurrentThread.ManagedThreadId );
// The return statement specifies an integer result.
// Any methods that a www.ysyl157.com re awaiting AccessTheWebAsync retrieve the length value.
return urlContents.Length;
}
public static void DoIndependentWork()
{
Console.WriteLine("work ......"+Thread.CurrentThread.ManagedThreadId);
}

猜你喜欢

转载自www.cnblogs.com/qwangxiao/p/10686852.html