While this is a general problem, it feels like it is mostly specific to the code that handles configuration classes. When creating bean definitions for an inner class, the generator currently creates a top level class where the $ separator is replaced by a _. Using inner classes is quite popular so fixing this would reduce the number of generated classes and make the generated code more consistent.

Comment From: snicoll

I went down the route of trying to make that transparent by patching GeneratedClasses. It turns out it brings a number of problem:

  1. The code that get an inner class is not responsible of creating the hierarchy, if necessary. This makes it hard to figure out what the type customization of the enclosing class should be
  2. Dealing with unique class name is a bit fuzzy as it's unclear if the uniqueness should apply to the enclosing class, or the inner class within the same enclosing class

Implementing this specifically for bean methods generation solves both problems.