本文介绍了无法启动bean'eurekaAutoServiceRegistration';由No Scope引起,未为作用域名称"refresh"注册的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于没有为作用域名称'refresh'注册任何作用域而导致无法启动bean eurekaAutoServiceRegistration

Failed to start bean eurekaAutoServiceRegistration caused by No Scope registered for scope name 'refresh'

@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class })
@EnableDiscoveryClient
public class WebRun extends SpringBootServletInitializer {

    public SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(WebRun.class);
    }

    public static void main(String[] args) {
        SpringApplication.run(WebRun.class, args);
    }

    }

推荐答案

我认为您项目配置错误或依赖项中的版本不匹配. br>
案例(1):
请检查您没有不超过一个扩展SpringBootServletInitializer 的课程.
在我的一个项目中,我错误地使用了以下两个类:

I think you have a mistake in your project configuration or a version mismatching in your dependencies.

Case(1):
Please check you don't have more than one class that extends SpringBootServletInitializer.
In one of the my projects, I had the two below classes by mistake:

@SpringBootApplication
@EnableEurekaClient
public class MyApplication extends SpringBootServletInitializer {

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        return builder.sources(MyApplication.class);
    }

    public static void main(String[] args) {
        SpringApplication.run(MyApplication.class, args);
    }
}

public class ServletInitializer extends SpringBootServletInitializer {

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(CamponoApplication.class);
    }

}

因此,我从我的项目中删除了第二堂课,问题得以解决.

希望对您有帮助

Therefore, I deleted the second class from the my project and the problem was solved.

I hope this helps you

这篇关于无法启动bean'eurekaAutoServiceRegistration';由No Scope引起,未为作用域名称"refresh"注册的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-26 11:42