This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.apache.velocity.VelocityContext; | |
import org.apache.velocity.app.Velocity; | |
import org.apache.velocity.app.event.EventCartridge; | |
import java.io.StringWriter; | |
import java.util.HashSet; | |
import java.util.Set; | |
import java.util.regex.Matcher; | |
import java.util.regex.Pattern; | |
import java.util.stream.Collectors; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Can be use MDC to add addional information | |
// ********************** LOG4J appenders ****************************** | |
// JDBC | |
https://logging.apache.org/log4j/2.x/manual/appenders.html#JDBCAppender | |
// JPA | |
https://logging.apache.org/log4j/2.x/manual/appenders.html#JPAAppender | |
// Kafka |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Bean | |
public ParameterNameDiscoverer parameterNameDiscoverer() { | |
return new DefaultParameterNameDiscoverer(); | |
} | |
... | |
@Autowired | |
private ParameterNameDiscoverer parameterNameDiscoverer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Configuration | |
public class VersionScanner implements ApplicationContextAware { | |
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { | |
for (String beanName : applicationContext.getBeanDefinitionNames()) { | |
Object obj = applicationContext.getBean(beanName); | |
/* | |
* As you are using AOP check for AOP proxying. If you are proxying with Spring CGLIB (not via Spring AOP) | |
* Use org.springframework.cglib.proxy.Proxy#isProxyClass to detect proxy If you are proxying using JDK |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void get(Type type) { | |
if (type instanceof ParameterizedType) { | |
ParameterizedType parameterizedType = (ParameterizedType) type; | |
Class<?> ownerType = (Class<?>) parameterizedType.getRawType(); | |
Type[] actualTypeArguments = parameterizedType.getActualTypeArguments(); | |
} else if (type instanceof Class) { | |
Class<?> type1 = (Class<?>) type; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MainView extends Div implements PageConfigurator { | |
@Override | |
public void configurePage(InitialPageSettings settings) { | |
// HashMap<String, String> attributes = new HashMap<>(); | |
// attributes.put("rel", "shortcut icon"); | |
// attributes.put("type", "image/png"); | |
// settings.addLink("icons/icon.png", attributes); | |
settings.addFavIcon("icon", "icons/icon.png", "48x48"); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dependencies { | |
compileOnly project (':generic-lib') // No Maven | |
} | |
jar { | |
enabled = true | |
from configurations.compileOnly.findAll { it.name.startsWith('generic-lib') }.collect { zipTree(it) } // Classes files | |
// from configurations.compileOnly.findAll { it.name.startsWith('generic-lib') }.collect { zipTree(it) } // Jar | |
// from configurations.compileOnly.findAll { it.name.startsWith('generic-lib')}.collect { zipTree(it).matching { | |
exclude('META-INF/**') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RequiredArgsConstructor | |
public class KafkaBaseConfig { | |
public static final int DEFAULT_CONCURRENCY = 1; | |
private final KafkaProperties kafkaProperties; | |
private final ConcurrentKafkaListenerContainerFactoryConfigurer concurrentKafkaListenerContainerFactoryConfigurer; | |
private Map<String, Object> consumerConfigs(String groupName) { | |
Map<String, Object> props = new HashMap<>(kafkaProperties.getProperties()); | |
props.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest"); | |
props.put(ConsumerConfig.GROUP_ID_CONFIG, groupName); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import io.jsonwebtoken.impl.DefaultJwtParser; | |
import java.util.Date; | |
/** | |
* JWT Parser with expiration time always valid | |
*/ | |
public final class IgnoreExpTimeJwtParser extends DefaultJwtParser { | |
private static final Date MINIMUM_DATE = new Date(Long.MIN_VALUE); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this.router.navigate(['/persons', '1'], {queryParams: data, state: {data: data}}); | |
const paramPath = this.activatedRoute.params.subscribe(params => console.log(params)); | |
const paramsSub = this.activatedRoute.queryParams.subscribe(params => console.log(params)); | |
let subscription = this.activatedRoute.paramMap | |
.pipe(map(() => window.history.state)) | |
.subscribe((state) => { | |
const data = state.data; | |
console.log(data); | |
}); |