Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to have multiple public classes in one file for spring?

 
Siegfried Heintze
Ranch Hand
Posts: 403
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to instantiate some classes using spring with java. This is working.

I'm trying to apply this to some automated code generation and I would like to have all my code in a single file.

Unfortunately, java only lets me have one public class in each source code file. When spring tries to instantiate classes that are not public, it cannot.

Is there a way around this java constraint? Maybe some scripting language like groovy?

Thanks,
Siegfried
 
Siegfried Heintze
Ranch Hand
Posts: 403
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yup, it works with groovy. Apparently groovy ignores the keyword public in front of classes and makes all classes public.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic