Skip to content

Class loading is broken with Spring Boot's DevTools again. #396

@michael-simons

Description

@michael-simons

Hello Luke,

Sadly #331 introduced a regression of #267.

That became apparent in a change of Neo4j-OGM where we now rely on ClassGraph being able to find scanned classes.

Find attached a reproducer:

try(ScanResult r = new ClassGraph()
			.ignoreClassVisibility()
			.whitelistPackages("com.example.gh729.domain")
			.scan()) {

			for(ClassInfo classInfo : r.getAllClasses()) {
				if("com.example.gh729.domain.SomeClass".equals(classInfo.getName())) {
					SomeClass f = (SomeClass) classInfo.loadClass().getConstructor().newInstance();
				}
			}
		}

This works in 4.8.17 and starts to fail in 4.8.19 again (as before my contribution).

This is the expected order of class loaders withorg.springframework.boot.devtools.restart.classloader.RestartClassLoader present

image

This is now what I get in 4.8.19+

image

Both screenshots from debugging into io.github.classgraph.ClassGraphClassLoader and displaying the order of class loaders used.

Find the reproducer attached. Open in your IDE and run Gh729Application.

gh729.zip

Related OGM ticket is neo4j/neo4j-ogm#729

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions