> For the complete documentation index, see [llms.txt](https://ec9help.weaver.com.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ec9help.weaver.com.co/5-backend-development.md).

# 5 Backend Development

## 1. Install idea and e-code

> Weaver suggest idea as the development IDE, please check [www.jetbrains.com](http://www.jetbrains.com/) for more details.

1. Install idea follow the official installation guideline
2. Install latest e-code on e-cology environment

## 2. Create Project

1. Create a new project: File->New->Project

<figure><img src="https://github.com/WeaverBPM/ecology/raw/main/images/newproject.png" alt=""><figcaption></figcaption></figure>

2. select java project

<figure><img src="https://github.com/WeaverBPM/ecology/raw/main/images/javaproject.png" alt=""><figcaption></figcaption></figure>

3. Click Next

<figure><img src="https://github.com/WeaverBPM/ecology/raw/main/images/clicknext.png" alt=""><figcaption></figcaption></figure>

4. Click Next, enter project name, and click finish

<figure><img src="https://github.com/WeaverBPM/ecology/raw/main/images/projectname.png" alt=""><figcaption></figcaption></figure>

## 3. Configure the SDK

1. Go to project setting, File->Project Structure

<figure><img src="https://github.com/WeaverBPM/ecology/raw/main/images/projectstructure.png" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://github.com/WeaverBPM/ecology/raw/main/images/sdk.png" alt=""><figcaption></figcaption></figure>

3. Click prject，set Project SDK as 1.8 and Project language level as SDK default 8

<figure><img src="https://github.com/WeaverBPM/ecology/raw/main/images/defaultsdk.png" alt=""><figcaption></figcaption></figure>

## 4. Configure project dependencies

1. Go to project setting：File->Project Structure

<figure><img src="https://github.com/WeaverBPM/ecology/raw/main/images/projectstructure.png" alt=""><figcaption></figcaption></figure>

2. Add dependency library: Libaries->+->java

<figure><img src="https://github.com/WeaverBPM/ecology/raw/main/images/depen_library.png" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://github.com/WeaverBPM/ecology/raw/main/images/ecologypath.png" alt=""><figcaption></figcaption></figure>

```
ecology/classbean
ecology/web-inf/lib
resin4/lib
```

4. After add all library and e-cology path, click apply.

<figure><img src="https://github.com/WeaverBPM/ecology/raw/main/images/libraryapplysetting.png" alt=""><figcaption></figcaption></figure>

## 5. Write your testing code now

1. Right click SRC->New->Package

<figure><img src="https://github.com/WeaverBPM/ecology/raw/main/images/newpackage.png" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://github.com/WeaverBPM/ecology/raw/main/images/newjavaimpl.png" alt=""><figcaption></figcaption></figure>

3. Testing Code

```java
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

1. Go to project setting: File->Project Structure

<figure><img src="https://github.com/WeaverBPM/ecology/raw/main/images/projectstructure.png" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://github.com/WeaverBPM/ecology/raw/main/images/Artifacts.png" alt=""><figcaption></figcaption></figure>

3. 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

<figure><img src="https://github.com/WeaverBPM/ecology/raw/main/images/jarprefix.png" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://github.com/WeaverBPM/ecology/raw/main/images/outputdirectory.png" alt=""><figcaption></figcaption></figure>

5. add src output to jar package and then click Apply

<figure><img src="https://github.com/WeaverBPM/ecology/raw/main/images/moduleoutput.png" alt=""><figcaption></figcaption></figure>

6. Select build->Build Artifacts

<figure><img src="https://github.com/WeaverBPM/ecology/raw/main/images/BuildArtifacts.png" alt=""><figcaption></figcaption></figure>

7. Click build, you could complete your build process
8. Check build result in e-cology system

## 7. resin remote debug configuration

1. 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
```

<figure><img src="https://github.com/WeaverBPM/ecology/raw/main/images/jvm_args.png" alt=""><figcaption></figcaption></figure>

2. Add middleware connection

<figure><img src="https://github.com/WeaverBPM/ecology/raw/main/images/addconnections.png" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://github.com/WeaverBPM/ecology/raw/main/images/addremoteresin.png" alt=""><figcaption></figcaption></figure>

4. Select configure and select resin home

<figure><img src="https://github.com/WeaverBPM/ecology/raw/main/images/configureresinhome.png" alt=""><figcaption></figcaption></figure>

5. Add jar package

<figure><img src="https://github.com/WeaverBPM/ecology/raw/main/images/addjarpackage.png" alt=""><figcaption></figcaption></figure>

6. Select pre-defined Artifacts, and click apply to save

<figure><img src="https://github.com/WeaverBPM/ecology/raw/main/images/ApplyResinSetting.png" alt=""><figcaption></figcaption></figure>

7. If in the same system, please select

<figure><img src="https://github.com/WeaverBPM/ecology/raw/main/images/SameSystem.png" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://github.com/WeaverBPM/ecology/raw/main/images/debugport.png" alt=""><figcaption></figcaption></figure>

9. start debug in service

<figure><img src="https://github.com/WeaverBPM/ecology/raw/main/images/debuginservice.png" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://github.com/WeaverBPM/ecology/raw/main/images/debugsuccessfully.png" alt=""><figcaption></figcaption></figure>
