5 Backend Development
1. Install idea and e-code
Weaver suggest idea as the development IDE, please check www.jetbrains.com for more details.
Install idea follow the official installation guideline
Install latest e-code on e-cology environment
2. Create Project
Create a new project: File->New->Project

select java project

Click Next

Click Next, enter project name, and click finish

3. Configure the SDK
Go to project setting, File->Project Structure

Click SDK->+, to add JDK1.8 into project

Click prject,set Project SDK as 1.8 and Project language level as SDK default 8

4. Configure project dependencies
Go to project setting:File->Project Structure

Add dependency library: Libaries->+->java

Get your demo/testing e-cology environment, and import below file/folder path

ecology/classbean
ecology/web-inf/lib
resin4/lib
After add all library and e-cology path, click apply.

5. Write your testing code now
Right click SRC->New->Package

Right click package->new->Java, please note the package should include impl, then can support non-intrusive development

Testing Code
package com.api.cs.test20200529.service.impl;
import com.weaverboot.frame.ioc.anno.classAnno.WeaIocReplaceComponent;
import com.weaverboot.frame.ioc.anno.methodAnno.WeaReplaceAfter;
import com.weaverboot.frame.ioc.anno.methodAnno.WeaReplaceBefore;
import com.weaverboot.frame.ioc.handler.replace.weaReplaceParam.impl.WeaAfterReplaceParam;
import com.weaverboot.frame.ioc.handler.replace.weaReplaceParam.impl.WeaBeforeReplaceParam;
import com.weaverboot.tools.logTools.LogTools;
@WeaIocReplaceComponent
public class Test {
@WeaReplaceBefore(value = "/api/workflow/reqlist/splitPageKey",order = 1,description = "Test before interrupt")
public void beforeTest(WeaBeforeReplaceParam weaBeforeReplaceParam){
//Some code here
LogTools.info("before:/api/workflow/reqlist/splitPageKey");
}
@WeaReplaceAfter(value = "/api/workflow/reqlist/splitPageKey",order = 1,description = "Test after interrupt")
public String after(WeaAfterReplaceParam weaAfterReplaceParam){
String data = weaAfterReplaceParam.getData();//This is the result after the action completed
LogTools.info("after:/api/workflow/reqlist/splitPageKey");
// LogTools.info(data);
return data;
}
}
6. Configuration compilation
Go to project setting: File->Project Structure

Go to Artifacts->+->JAR->Empty

Edit Name, please note if the code need to support non-intrusive development, jar package name must contain an underscore prefix, similar to the example writing

Modify jar output directory as ecology/web-inf/lib

add src output to jar package and then click Apply

Select build->Build Artifacts

Click build, you could complete your build process
Check build result in e-cology system
7. resin remote debug configuration
go to resin configuration file:resin4/config/resin.properties to edit jvm_args
jvm_args : -Xdebug -Xrunjdwp:transport=dt_socket,address=9081,server=y,suspend=n -Dcom.sun.management.jmxremote -Xloggc:/var/log/gc.log -Xmx1550m -Xms1550m -XX:ParallelGCThreads=20 -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+DisableExplicitGC
jvm_mode : -server

Add middleware connection

ADD +->Resin->Remote Service, input ec server address URL and remote resin debug port

Select configure and select resin home

Add jar package

Select pre-defined Artifacts, and click apply to save

If in the same system, please select

Switch Startup/Connection, modify Debug->port as resin remote debug port

start debug in service

Go to sepecial page to refresh, if breakpoint stop successfully, then debug configure is successfully

Last updated