Skip to content

Instantly share code, notes, and snippets.

@lofidewanto
lofidewanto / SecurityConfiguration.java
Created December 16, 2023 10:36
Konfiguration für die Zusammenführung von Rollen und Scopes (OAuth2) in Spring Security 6.2 und Spring Boot 3.2
package com.example.test;
import java.util.Collection;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
@lofidewanto
lofidewanto / OptionalTextBox.java
Created November 5, 2020 22:41
Component Domino Composite
package org.dominokit.samples;
import elemental2.dom.HTMLDivElement;
import org.dominokit.domino.ui.forms.CheckBox;
import org.dominokit.domino.ui.forms.TextBox;
import org.dominokit.domino.ui.grid.flex.FlexDirection;
import org.dominokit.domino.ui.grid.flex.FlexItem;
import org.dominokit.domino.ui.grid.flex.FlexLayout;
import org.dominokit.domino.ui.utils.BaseDominoElement;
@lofidewanto
lofidewanto / ProductCompositeTest.java
Last active October 28, 2020 20:50
IndexedDB with Patterns - Unit Test with JUnit and Mockito
package com.github.lofi.client;
import static org.mockito.Mockito.doReturn;
...
import org.jboss.elemento.InputBuilder;
...
@ExtendWith(MockitoExtension.class)
@RunWith(JUnitPlatform.class)
class ProductCompositeTest {
@lofidewanto
lofidewanto / ProductComposite.java
Last active October 28, 2020 20:45
IndexedDB with Patterns - Composite UI
package com.github.lofi.client;
import static org.jboss.elemento.Elements.br;
...
import java.util.logging.Logger;
...
@Singleton
public class ProductComposite {
private static Logger logger = Logger.getLogger(ProductComposite.class.getName());
@lofidewanto
lofidewanto / Product.java
Created October 28, 2020 17:40
IndexedDB with Java Patterns - Rich Domain Model
package com.github.lofi.client;
public class Product {
private final String id;
private final String name;
...
private Product(Builder productBuilder) {
this.id = productBuilder.id;
this.name = productBuilder.name;
@lofidewanto
lofidewanto / Repository.java
Created October 28, 2020 10:30
IndexedDB with Java Patterns - Repository.java
package com.github.lofi.client;
import java.util.Optional;
import java.util.Set;
interface Repository<T> {
Optional<T> get(String id);
Set<T> get();
void persist(T entity);
void remove(T entity);
@lofidewanto
lofidewanto / ProductService.java
Last active October 25, 2020 20:07
IndexedDB with Java Patterns - Using Dagger2 - Consumer
package com.github.lofi.client;
import java.util.logging.Logger;
import javax.inject.Inject;
import javax.inject.Singleton;
@Singleton
public class ProductService {
private static Logger logger = Logger.getLogger(ProductService.class.getName());
private ProductIdbRepository productRepository;
@lofidewanto
lofidewanto / comparison.csv
Last active October 25, 2020 16:30
IndexedDB with Java Patterns - Comparison Dagger2 and Spring Boot Annotations
Spring Boot Dagger2 Explanation
@Configuration @Module A class that provides or builds the objects' dependencies
@Bean @Provides Create the objects
@SpringBootApplication @Component Interface used to generate the injector for the entry point and serves as a bridge between dependency providers (@Module) and dependency users (@Inject)
@Component @Service @Singleton Marking the classes to be managed as Singleton by DI framework
@Scope @Singleton or nothing Scoping the objects
@Autowired @Inject Inject the object to the marked property or constructor
@lofidewanto
lofidewanto / AppEntryPoint.java
Last active October 27, 2020 22:30
IndexedDB with Java Patterns - Entry Point
package com.github.lofi.client
import java.util.logging.Logger;
import com.google.gwt.core.client.EntryPoint;
public class AppEntryPoint implements EntryPoint {
private static Logger logger = Logger.getLogger(AppEntryPoint.class.getName());
@Override
public void onModuleLoad() {
@lofidewanto
lofidewanto / pom.xml
Last active October 25, 2020 14:24
IndexedDB with Java Patterns - GWT Boot pom.xml - Maven Plugin
...
<build>
<plugins>
<!-- GWT Maven Plugin -->
<plugin>
<groupId>net.ltgt.gwt.maven</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<configuration>
<moduleName>
com.github.lofi.Calculator