小编Atu*_*tul的帖子

这个代码构造包装库的各个部分是什么?它有用的是什么?

我模仿了一个库,并能够编写以下代码.此代码创建了分配功能的'c'对象'a'.所以,要打电话'a',我将不得不写c.a().

此外,我能够为此'c'对象添加更多功能.我想了解这段代码中发生了什么.它看起来不像普通的面向对象编程.这种类型的javascript编程叫什么?

var c = (function(c) {
    if (c === undefined) {
        c = {};
    }

    function a() {
        alert(1);
    }
    c.a = a;
    return c;
}(c));
Run Code Online (Sandbox Code Playgroud)

javascript module-pattern

39
推荐指数
4
解决办法
4061
查看次数

由于相同的 bean,应用程序无法启动

我有一个Spring Webflux应用程序,我试图从旧模块加载依赖项(旧模块位于Spring WebMVC框架上)。

当应用程序启动时,抛出此错误 -

***************************
APPLICATION FAILED TO START
***************************

Description:

The bean 'requestMappingHandlerAdapter', defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class], could not be registered. A bean with that name has already been defined in class path resource [org/springframework/web/reactive/config/DelegatingWebFluxConfiguration.class] and overriding is disabled.

Action:

Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true
Run Code Online (Sandbox Code Playgroud)

我希望启动 webflux 包中的所有 bean,所以我无法设置spring.main.allow-bean-definition-overriding=true.

还尝试在组件扫描时排除 org.springframework.boot 中的所有类 - @ComponentScan(excludeFilters = @Filter(type = FilterType.REGEX, pattern = "org.springframework.boot*")。还尝试排除我的 webflux …

java spring spring-mvc spring-boot spring-webflux

7
推荐指数
2
解决办法
1万
查看次数