org.zeroturnaround.javarebel.integration.spring.SpringMvcPlugin Maven / Gradle / Ivy
package org.zeroturnaround.javarebel.integration.spring;
import org.zeroturnaround.javarebel.ClassResourceSource;
import org.zeroturnaround.javarebel.IntegrationFactory;
import org.zeroturnaround.javarebel.Plugin;
import org.zeroturnaround.javarebel.integration.spring.cbp.AbstractDetectingUrlHandlerMappingCBP;
import org.zeroturnaround.javarebel.integration.spring.cbp.AnnotationMethodHandlerAdapterCBP;
import org.zeroturnaround.javarebel.integration.spring.cbp.DefaultAnnotationHandlerMappingCBP;
import org.zeroturnaround.javarebel.integration.spring.cbp.DispatcherServletCBP;
/**
* JavaRebel Spring plugin that manages Spring metadata reloading.
*
* @author Jevgeni Kabanov
*/
public class SpringMvcPlugin implements Plugin{
private static final boolean enabled = Boolean.getBoolean("rebel.spring_plugin");
public void preinit() {
if (!enabled) return;
ClassLoader cl = SpringMvcPlugin.class.getClassLoader();
/*
* Refreshes Handler list on every request.
*/
IntegrationFactory.getInstance()
.addIntegrationProcessor(
cl,
"org.springframework.web.servlet.handler.AbstractDetectingUrlHandlerMapping",
new AbstractDetectingUrlHandlerMappingCBP());
/*
* Reloads Spring Bean definitions on every request (including rescanning classpath for new components).
*/
IntegrationFactory.getInstance()
.addIntegrationProcessor(
cl,
"org.springframework.web.servlet.DispatcherServlet",
new DispatcherServletCBP());
/*
* Disables @RequestMapping type-level handler cache.
*/
IntegrationFactory.getInstance()
.addIntegrationProcessor(
cl,
"org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping",
new DefaultAnnotationHandlerMappingCBP());
/*
* Disables @RequestMapping method-level handler cache.
*/
IntegrationFactory.getInstance()
.addIntegrationProcessor(
cl,
"org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter",
new AnnotationMethodHandlerAdapterCBP());
}
public boolean checkDependencies(ClassLoader cl, ClassResourceSource crs) {
return crs.getClassResource("org.springframework.web.servlet.DispatcherServlet") != null;
}
public String getDescription() {
return null;
}
public String getId() {
return "spring_plugin";
}
public String getName() {
return null;
}
public String getAuthor() {
return null;
}
public String getWebsite() {
return null;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy