ant-nest

蚂蚁巢,专注于方便的注解

OTHER License

Stars
1
Committers
2

ant-nest

,

<dependency>
  <groupId>com.github.hwywl</groupId>
  <artifactId>ant-nest</artifactId>
  <version>1.1.11-RELEASE</version>
</dependency>

spring-boot-mybatis-druid



@WebLog

controller

@SqlStatement mybatis SQL

mybatisSQLSQL


@OperatingTime

/

@AESEncryptBody & @DESEncryptBody

application.properties,16

encrypt.body.aes-key=1234567812345678
encrypt.body.des-key=1234567812345678

mvc

@RestController
@DESEncryptBody
public class BaikeController {
    @Autowired
    BaikeService baikeService;

    @RequestMapping(value = "/selectByExample", method = RequestMethod.POST)
    public MessageResult selectByExample(){
        BaikeExample example = new BaikeExample();
        BaikeExample.Criteria criteria = example.createCriteria();
        criteria.andNameEqualTo("");

        List<Baike> baikes = baikeService.selectByExample(example);

        return MessageResult.ok(baikes);
    }

    @RequestMapping(value = "/selectById", method = RequestMethod.POST)
    public MessageResult selectById(){
        Baike baike = baikeService.selectByPrimaryKey(1L);

        return MessageResult.ok(baike);
    }
}

@DESEncryptBody
@RequestMapping(value = "/selectById", method = RequestMethod.POST)
public MessageResult selectById(){
    Baike baike = baikeService.selectByPrimaryKey(1L);

    return MessageResult.ok(baike);
}

@DESDecryptBody
@RequestMapping(value = "/selectByIdDecrypt", method = RequestMethod.GET)
public MessageResult selectByIdDecrypt(@RequestBody String content){

    System.out.println(content);

    return MessageResult.ok(content);
}

@RequestBody

postman

  • AES:ECB:pkcs5padding:128: key: ECB:hexUTF-8

  • DES:ECB:pkcs5padding:128: key: ECB:hexUTF-8

http://tool.chacuo.net/cryptaes

@MethodCounter

@MethodCounter

Long num = MethodCounterAspect.cacheMap.get("");

@GetProperties properties

bean

resources, resources****aaaaa.properties

@Configuration
@GetProperties(properties = "aaaa/a.properties")
public class Config {

}

resourcesc.propertiesd.properties

@RequestMapping(value = "/selectByIdEncrypt", method = RequestMethod.POST)
@GetProperties(properties = {"d.properties", "c.properties"})
public MessageResult selectByIdEncrypt(){


    Baike baike = baikeService.selectByPrimaryKey(1L);

    Map cachemap = GetPropertiesListener.CACHEMAP;
    System.out.println(cachemap.get("d.spring.datasource.username"));

    return MessageResult.ok(baike);
}

aaaa/a.properties

mybatis.type-aliases-package=com.yi.mybatis.model

++key

Object value = GetPropertiesListener.CACHEMAP.get("aaaa.a.mybatis.type-aliases-package");

d.properties

mybatis.type-aliases-package=com.yi.mybatis.model

+key

Object value = GetPropertiesListener.CACHEMAP.get("d.mybatis.type-aliases-package");

/

@GetProperties(properties = "aaaa/a.properties")
@GetProperties(properties = "/aaaa/a.properties")

@ZooLock zookeeper

application.properties

# zookeeper
# true
zk.lock.enabled=true
zk.lock.url=127.0.0.1:2181
# 3
zk.lock.retry=3
# ()
zk.lock.timeout=1000
/**
 * 
 * <p>key/DISTRIBUTED_LOCK_books</p>
 * @return
 * @throws InterruptedException
 */
@ZooLock(key = "books")
@RequestMapping(value = "/selectByExample", method = RequestMethod.POST)
public MessageResult selectByExample() throws InterruptedException {
    BaikeExample example = new BaikeExample();
    BaikeExample.Criteria criteria = example.createCriteria();

    criteria.andNameEqualTo("");
    List<Baike> hBaikes = baikeService.selectByExample(example);
    List<Baike> allBooks = new ArrayList<>(hBaikes);

    Thread.sleep(6000);

    return MessageResult.ok(allBooks);
}

key

/**
 * @LockKeyParam keyidbook 1  
 * <p>key/DISTRIBUTED_LOCK_books/1/</p>
 * @param baike 
 * @return
 * @throws InterruptedException
 */
@ZooLock(key = "books", timeout = 3000L)
@RequestMapping(value = "/getBaikes", method = RequestMethod.POST)
public MessageResult getBaikes(@LockKeyParam(fields = {"id","book"}) Baike baike) throws InterruptedException {
    System.out.println("");
    Thread.sleep(5000);
    System.out.println("");

    return MessageResult.ok(baike);
}

Baikeidbook@LockKeyParamkeykey

@LockKeyParam

/**
 * @LockKeyParam keyname 
 * <p>key/DISTRIBUTED_LOCK_books/</p>
 * @param name 
 * @return
 * @throws InterruptedException
 */
@ZooLock(key = "books", timeout = 3000L)
@RequestMapping(value = "/getBaikeName", method = RequestMethod.POST)
public MessageResult getBaikes(@LockKeyParam String name) throws InterruptedException {
    System.out.println("");
    Thread.sleep(5000);
    System.out.println("");

    return MessageResult.ok(name);
}

Package Rankings
Top 47.01% on Repo1.maven.org
Badges
Extracted from project README
author LICENSE Maven Central
Related Projects