我在JavaScript中使用模块化模式.我想知道我们是否可以阻止公共模块被覆盖.例如,在function1下面的代码中,function2,function3和function4可以在外面访问,但我不想覆盖.如果重写这些函数,那么我希望编译器生成错误消息
"use strict";
var $ = (function(){
return{
function1 : function(){
alert("this is Function1");
},
function2 : function(){
alert("this is Function2");
},
function3 : function(){
alert("this is Function3");
},
function4 : function(){
alert("this is Function4");
}
};
}());
$.function1(); //will alert - this is Function1
$.function2(); //will alert - this is Function2
/*
I don't want to do this, If I do, then I want the compiler to generate an
error message
*/
$.function3=function(){
alert('function 3 …
Run Code Online (Sandbox Code Playgroud) 我在 Websphere 部署中使用PARENT_LAST。但是,我收到异常:无法加载 webapp: javax.servlet.ServletContainerInitializer: Provider org.springframework.web.SpringServletContainerInitializer not a subtype。
我错过了什么吗?
[3/25/18 19:10:50:512 EDT] 00000078 SystemErr R com.ibm.ws.exception.RuntimeWarning: com.ibm.ws.webcontainer.exception.WebAppNotLoadedException: Failed to load webapp: Failed to load webapp: javax.servlet.ServletContainerInitializer: Provider org.springframework.web.SpringServletContainerInitializer not a subtype
Run Code Online (Sandbox Code Playgroud)
Caused by: java.util.ServiceConfigurationError: javax.servlet.ServletContainerInitializer: Provider org.springframework.web.SpringServletContainerInitializer not a subtype
[3/25/18 19:10:50:524 EDT] 00000078 SystemErr R at java.util.ServiceLoader.fail(ServiceLoader.java:242)
[3/25/18 19:10:50:524 EDT] 00000078 SystemErr R at java.util.ServiceLoader.access$300(ServiceLoader.java:192)
[3/25/18 19:10:50:524 EDT] 00000078 SystemErr R at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:380)
[3/25/18 19:10:50:524 EDT] 00000078 SystemErr R at java.util.ServiceLoader$1.next(ServiceLoader.java:456)
[3/25/18 19:10:50:524 EDT] 00000078 …
Run Code Online (Sandbox Code Playgroud)