Skip to content

Instantly share code, notes, and snippets.

View shell-sub.sh
ls -rt | head -$((`ls|wc -l` - 1))
View AopSample.java
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Component;
View eureka-client.yml
eureka.instance.hostname: ${spring.cloud.client.ip-address} # 注册中心的地址以 ip:port 的形式存储,否则会在其他主机上出现 localhost 的地址
@moods445
moods445 / application.properties
Created Apr 2, 2019
spring boot rabbitmq configurations #Java
View application.properties
# RABBIT (RabbitProperties) https://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html#common-application-properties
spring.rabbitmq.addresses= # Comma-separated list of addresses to which the client should connect.
spring.rabbitmq.cache.channel.checkout-timeout= # Duration to wait to obtain a channel if the cache size has been reached.
spring.rabbitmq.cache.channel.size= # Number of channels to retain in the cache.
spring.rabbitmq.cache.connection.mode=channel # Connection factory cache mode.
spring.rabbitmq.cache.connection.size= # Number of connections to cache.
spring.rabbitmq.connection-timeout= # Connection timeout. Set it to zero to wait forever.
spring.rabbitmq.dynamic=true # Whether to create an AmqpAdmin bean.
spring.rabbitmq.host=localhost # RabbitMQ host.
spring.rabbitmq.listener.direct.acknowledge-mode= # Acknowledge mode of container.
@moods445
moods445 / MyClassLoader
Last active Feb 13, 2019
Custom ClassLoader #Java
View MyClassLoader
JarFile jarFile = new JarFile(jarFilePath.toFile());
URLClassLoader jarClassLoader = new URLClassLoader(
new URL[]{jarFilePath.toUri().toURL()},
this.getClass().getClassLoader()
);
Class tClass = Class.forName(className, true, classLoader);
@moods445
moods445 / HttpMethod
Last active Jun 22, 2019
Bean validation #Java
View HttpMethod
package cn.internetware.yancloud.dataretention.schedule.constraints;
import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.*;
/**
*
*/
@Documented