Skip to content

Binder conversion fails intermittently when called from multiple threads #27813

@Linyuzai

Description

@Linyuzai

I compile a jar to provide coroutines for java, like 'kotlin-coroutines-java-support.jar'.

It works well until org.springframework.boot.context.properties.bind.Binder used.

I use binder like this:

//custom properties
Map<String, Object> map = new LinkedHashMap<>();
map.put("demo.get", 1);
map.put("demo.list", "1,2,3");
map.put("demo.map.m1", true);
map.put("demo.map.m2", false);
map.put("demo.el", "el,${demo.get}");

StandardEnvironment env = new StandardEnvironment();
//remove default propertySources
//......
//add new
OriginTrackedMapPropertySource propertySource = new OriginTrackedMapPropertySource("newEnv", map, true);
env.getPropertySources().addFirst(propertySource);

//class to bind
@Data
public static class DemoBinderToUse {

  private int get;

  private String el;

  private List<Integer> list;

  private Map<String, Boolean> map;
}

//finally run in coroutines concurrently
Binder.get(env).bindOrCreate("demo", DemoBinderToUse.class);

List's value is wrong sometimes

image

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions