Skip to main content

dawdler-server-plug-load

Module Introduction​

dawdler-server-plug-load is the server side, which provides the loading of remote web components.

It supports remote loading of the following three types of components:

  1. Web-side controller

  2. Web-side interceptor HandlerInterceptor

  3. Web-side listener WebContextListener

1. Adding the Dependency to pom​

<groupId>club.dawdler</groupId>
<artifactId>dawdler-server-plug-load</artifactId>

2. Configuring the Components to Be Loaded​

Note: configuration is required only when providing a remote loading service.

dawdler provides a service for remotely loading components. In the project's services-conf.xml under resources, there is a remote-load node used to specify the configuration file.

<!-- This is the class node of the current project -->
<remote-load package="load-config.xml"></remote-load>

The load-config.xml file is used to configure which packages in this service can be remotely loaded. The supported components are controller, listener, and interceptor.

Example load-config.xml:

<?xml version="1.0" encoding="UTF-8"?>
<hosts>
<host name="user">
<package>com.anywide.yyg.user.controller</package>
<package>com.anywide.yyg.user.interceptor</package>
</host>
</hosts>

load-config.xml serves the loads-on node in client-conf.xml, and client-conf.xml is configured on the caller side; it is only referenced here for illustration.

Example client-conf.xml:

<!-- Dynamically load configuration when the web application starts; dawdler-client-plug requires this configuration -->
<loads-on>
<item sleep="15000" channel-group-id="user-api" mode="run">user</item><!-- Load the user module; sleep is the update check interval in milliseconds; channel-group-id specifies the group; mode=run is run mode and does not check for updates -->
</loads-on>

3. Configuring the Packages to Scan​

The scanner in services-conf.xml

<scanner>
<package-paths>
<package-path>com.anywide.shop.listener</package-path>
<package-path>com.anywide.shop.**.service.impl</package-path>
</package-paths><!-- Paths to scan; ant-style paths are supported, such as com.anywide.shop.**.service.impl; components in the scanned packages take effect -->
</scanner>