Skip to content

Instantly share code, notes, and snippets.

View LeMikaelF's full-sized avatar

Mikaël Francoeur LeMikaelF

  • Québec, Canada
View GitHub Profile
@LeMikaelF
LeMikaelF / proposition.md
Created December 9, 2024 02:15
Proposition SB

Title: Allow collections with multiple types in Configuration Properties

Motivation

It's not uncommon for libraries or applications that accept configuration properties to need to extend their model. For example, here is a configuration for zalando/logbook, where the logbook.obfuscate.headers property is a list of strings, and is mapped to a List<String> in a @ConfigurationProperties-annotated class:

package org.example.springbarebones21;
import java.lang.reflect.Method;
import org.springframework.cglib.core.ReflectUtils;
import org.springframework.cglib.core.Signature;
import org.springframework.cglib.proxy.Callback;
import org.springframework.cglib.proxy.Factory;
import org.springframework.cglib.proxy.MethodInterceptor;
import org.springframework.cglib.proxy.MethodProxy;
@LeMikaelF
LeMikaelF / DemoTest.java
Created August 29, 2021 21:27
Test to reproduce Mockito issue #2409
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
@ExtendWith(MockitoExtension.class)