org.springsource.loaded.agent.SpringPlugin Maven / Gradle / Ivy
/*
* Copyright 2010-2012 VMware and contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springsource.loaded.agent;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.security.ProtectionDomain;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.objectweb.asm.ClassReader;
import org.springsource.loaded.GlobalConfiguration;
import org.springsource.loaded.LoadtimeInstrumentationPlugin;
import org.springsource.loaded.ReloadEventProcessorPlugin;
/**
* First stab at the Spring plugin for Spring-Loaded. Notes...
*
* - On reload, removes the Class entry in
* org/springframework/web/servlet/mvc/annotation/AnnotationMethodHandlerAdapter.methodResolverCache. This enables us to add/changes
* request mappings in controllers.
*
- That was for Roo, if we create a simple spring template project and run it, this doesn't work. It seems we need to redrive
* detectHandlers() on the DefaultAnnotationHandlerMapping type which will rediscover the URL mappings and add them into the handler
* list. We don't clear old ones out (yet) but the old mappings appear not to work anyway.
*
*
* @author Andy Clement
* @since 0.5.0
*/
public class SpringPlugin implements LoadtimeInstrumentationPlugin, ReloadEventProcessorPlugin {
private static Logger log = Logger.getLogger(SpringPlugin.class.getName());
// TODO [gc] what about GC here - how do we know when they are finished with?
public static List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy