Spring: disabling validation also disables autowiring? -


as had learn typical spring configuration files headers, e.g.:

<beans xmlns="http://www.springframework.org/schema/beans"     xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"     xmlns:aop="http://www.springframework.org/schema/aop"     xmlns:util="http://www.springframework.org/schema/util"     xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd         http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd         http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd"     default-autowire="byname">     ... 

do indeed cause spring reach out , fetch referenced .xsd files internet validation of config file(s). if can not find or download schemas, fails.

since code developing later run on servers won't have access internet need prevent this! so, wanted disable validation (which no issue, since config files thoroughly tested before code ever gets operational).

so came following class derived classpathxmlapplicationcontext overrides single method in order disable config-file validation:

classpathxmlapplicationcontext appspringcontext =      new classpathxmlapplicationcontext(new string[] {          "config/context_basicfw.xml",         "config/context_sbase.xml",         "config/openapi.xml",     }) {     @override     protected void initbeandefinitionreader(xmlbeandefinitionreader beandefinitionreader) {         super.initbeandefinitionreader(beandefinitionreader);         beandefinitionreader.setvalidationmode(xmlbeandefinitionreader.validation_none);         beandefinitionreader.setnamespaceaware(true);     } }; 

but dismay not disables validation - strange reason - auto-wiring of beans! i.e. if comment away 2 added lines (following super...-call) in overriding method initbeandefinitionreader() code runs fine. if enable 2 lines, initialization runs fine without downloading schemas code later throws nullpointerexceptions because of several beans supposed assigned via auto-wiring still being null.

how can disable spring's config file validation while maintaining full spring functionality, auto-wiring?

note: know change config files point local copies of schemas, work config files have control of. however, using couple of .jars contain own config files headers above , - if anyhow possible - don't want touch use them is, i.e. without having unpack them, modifying spring config files , re-packaging them.

any idea or suggestion anyone, how tell spring skip validation, still auto-wiring? btw: forced still use spring v2.0, no higher version!


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

Nuget pack csproj using nuspec -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -