Skip to content

Magician-Containers is a container management module that allows for the unified management of beans in a project, which brings two extensions: AOP and timed tasks

License

Notifications You must be signed in to change notification settings

JMagician/Magician-Containers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Magician-Containers is a container management module that allows for the unified management of beans in a project, which brings two extensions: AOP and timed tasks

Documentation

https://magician-io.com

Example

Importing dependencies

<!-- This is the jar package build by this project -->
<dependency>
    <groupId>com.magician.containers</groupId>
    <artifactId>Magician-Containers</artifactId>
    <version>1.0.1</version>
</dependency>

<!-- This is Magician -->
<dependency>
    <groupId>com.github.yuyenews</groupId>
    <artifactId>Magician</artifactId>
    <version>2.0.6</version>
</dependency>

<!-- This is the log package, which supports any package that can be bridged with slf4j -->
<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-jdk14</artifactId>
    <version>1.7.12</version>
</dependency>

Tagging beans

Cannot be used on controllers

@MagicianBean
public class DemoBean {

}

Aop

Writing the logic for AOP

public class DemoAop implements BaseAop {

    /**
     * Before method execution
     * @param args Parameters of the method being executed
     */
    public void startMethod(Object[] args) {

    }

    /**
     * After method execution
     * @param args Parameters of the method being executed
     * @param result Return data of the executed method
     */
    public void endMethod(Object[] args, Object result) {

    }

    /**
     * Method execution exception
     * @param e Exception information for the executed method
     */
    public void exp(Throwable e) {

    }
}

Listening to methods that need to be listened to

@MagicianBean
public class DemoBean {

    @MagicianAop(className = DemoAop.class)
    public void demoAopMethod() {

    }
}

Timer

@MagicianBean
public class DemoBean {

    // loop: Rotation interval, in milliseconds
    @MagicianTimer(loop=1000)
    public void demoTimerMethod() {

    }
}

getBean

@MagicianBean
public class DemoBean {

    private DemoBean demoBean = BeanUtil.get(DemoBean.class);
    
}

About

Magician-Containers is a container management module that allows for the unified management of beans in a project, which brings two extensions: AOP and timed tasks

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages