Alan-Gomes / mcspring-boot

A Spring boot starter for Bukkit/Spigot/PaperSpigot plugins
MIT License
78 stars 25 forks source link

Don't view #25

Closed Suro4ek closed 4 years ago

CC007 commented 4 years ago

You might need a org.switchyard.common.type.CompoundClassLoader in your onEnable():

...
        List<ClassLoader> springClassLoaders = new ArrayList<>();
        springClassLoaders.add(getClassLoader());
        springClassLoaders.add(Thread.currentThread().getContextClassLoader());
        ClassLoader classLoader = new CompoundClassLoader(springClassLoaders);

        Thread.currentThread().setContextClassLoader(classLoader);

        ResourceLoader loader = new DefaultResourceLoader(classLoader);
        SpringApplication application = new SpringApplication(loader, Application.class);
...

I believe this is needed since 1.15.2 for some reason. This is what I am using right now and it works perfectly.