File tree Expand file tree Collapse file tree 3 files changed +10
-5
lines changed
grails-core/src/main/groovy
grails-web-url-mappings/src/main/groovy/org/grails/web/mapping Expand file tree Collapse file tree 3 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -102,10 +102,12 @@ class GrailsApplicationPostProcessor implements BeanDefinitionRegistryPostProces
102102 protected void performGrailsInitializationSequence () {
103103 pluginManager. doArtefactConfiguration()
104104 grailsApplication. initialise()
105+ // register plugin provided classes first, this gives the oppurtunity
106+ // for application classes to override those provided by a plugin
107+ pluginManager. registerProvidedArtefacts(grailsApplication)
105108 for (cls in classes) {
106109 grailsApplication. addArtefact(cls)
107110 }
108- pluginManager. registerProvidedArtefacts(grailsApplication)
109111 }
110112
111113 protected void loadApplicationConfig () {
Original file line number Diff line number Diff line change @@ -301,7 +301,12 @@ public void setApplication(GrailsApplication application) {
301301 public void registerProvidedArtefacts (GrailsApplication app ) {
302302 checkInitialised ();
303303
304- for (GrailsPlugin plugin : pluginList ) {
304+ // since plugin classes are added as overridable artefacts, which are added as the first
305+ // item in the list of artefacts, we have to iterate in reverse order to ensure plugin
306+ // load sequence is maintained
307+ ArrayList <GrailsPlugin > plugins = new ArrayList <GrailsPlugin >(pluginList );
308+ Collections .reverse (plugins );
309+ for (GrailsPlugin plugin : plugins ) {
305310 if (plugin .supportsCurrentScopeAndEnvironment ()) {
306311 if (isPluginDisabledForProfile (plugin )) continue ;
307312 for (Class <?> artefact : plugin .getProvidedArtefacts ()) {
Original file line number Diff line number Diff line change @@ -79,16 +79,14 @@ public void afterPropertiesSet() throws Exception {
7979 List excludePatterns = new ArrayList ();
8080
8181 GrailsClass [] mappings = grailsApplication .getArtefacts (UrlMappingsArtefactHandler .TYPE );
82- List <GrailsClass > mappingList = Arrays .asList (mappings );
83- Collections .reverse (mappingList );
8482 final DefaultUrlMappingEvaluator mappingEvaluator = new DefaultUrlMappingEvaluator (applicationContext );
8583 mappingEvaluator .setPluginManager (pluginManager );
8684
8785 if (mappings .length == 0 ) {
8886 urlMappings .addAll (mappingEvaluator .evaluateMappings (DefaultUrlMappings .getMappings ()));
8987 }
9088 else {
91- for (GrailsClass mapping : mappingList ) {
89+ for (GrailsClass mapping : mappings ) {
9290 GrailsUrlMappingsClass mappingClass = (GrailsUrlMappingsClass ) mapping ;
9391 List grailsClassMappings ;
9492 if (Script .class .isAssignableFrom (mappingClass .getClazz ())) {
You can’t perform that action at this time.
0 commit comments