下面列出了怎么用org.springframework.web.servlet.view.groovy.GroovyMarkupConfigurer的API类实例代码及写法,或者点击链接到github查看源代码。
/**
* Register a Groovy markup view resolver with an empty default view name
* prefix and a default suffix of ".tpl".
*/
public UrlBasedViewResolverRegistration groovy() {
if (!checkBeanOfType(GroovyMarkupConfigurer.class)) {
throw new BeanInitializationException("In addition to a Groovy markup view resolver " +
"there must also be a single GroovyMarkupConfig bean in this web application context " +
"(or its parent): GroovyMarkupConfigurer is the usual implementation. " +
"This bean may be given any name.");
}
GroovyMarkupRegistration registration = new GroovyMarkupRegistration();
this.viewResolvers.add(registration.getViewResolver());
return registration;
}
@Before
public void setup() {
StaticWebApplicationContext context = new StaticWebApplicationContext();
context.registerSingleton("freeMarkerConfigurer", FreeMarkerConfigurer.class);
context.registerSingleton("tilesConfigurer", TilesConfigurer.class);
context.registerSingleton("groovyMarkupConfigurer", GroovyMarkupConfigurer.class);
context.registerSingleton("scriptTemplateConfigurer", ScriptTemplateConfigurer.class);
this.registry = new ViewResolverRegistry(new ContentNegotiationManager(), context);
}
/**
* Register a Groovy markup view resolver with an empty default view name
* prefix and a default suffix of ".tpl".
*/
public UrlBasedViewResolverRegistration groovy() {
if (!checkBeanOfType(GroovyMarkupConfigurer.class)) {
throw new BeanInitializationException("In addition to a Groovy markup view resolver " +
"there must also be a single GroovyMarkupConfig bean in this web application context " +
"(or its parent): GroovyMarkupConfigurer is the usual implementation. " +
"This bean may be given any name.");
}
GroovyMarkupRegistration registration = new GroovyMarkupRegistration();
this.viewResolvers.add(registration.getViewResolver());
return registration;
}
@Before
public void setup() {
StaticWebApplicationContext context = new StaticWebApplicationContext();
context.registerSingleton("freeMarkerConfigurer", FreeMarkerConfigurer.class);
context.registerSingleton("tilesConfigurer", TilesConfigurer.class);
context.registerSingleton("groovyMarkupConfigurer", GroovyMarkupConfigurer.class);
context.registerSingleton("scriptTemplateConfigurer", ScriptTemplateConfigurer.class);
this.registry = new ViewResolverRegistry(new ContentNegotiationManager(), context);
}
/**
* Register a Groovy markup view resolver with an empty default view name
* prefix and a default suffix of ".tpl".
*/
public UrlBasedViewResolverRegistration groovy() {
if (!checkBeanOfType(GroovyMarkupConfigurer.class)) {
throw new BeanInitializationException("In addition to a Groovy markup view resolver " +
"there must also be a single GroovyMarkupConfig bean in this web application context " +
"(or its parent): GroovyMarkupConfigurer is the usual implementation. " +
"This bean may be given any name.");
}
GroovyMarkupRegistration registration = new GroovyMarkupRegistration();
this.viewResolvers.add(registration.getViewResolver());
return registration;
}
/**
* Register a Groovy markup view resolver with an empty default view name
* prefix and a default suffix of ".tpl".
*/
public UrlBasedViewResolverRegistration groovy() {
if (this.applicationContext != null && !hasBeanOfType(GroovyMarkupConfigurer.class)) {
throw new BeanInitializationException("In addition to a Groovy markup view resolver " +
"there must also be a single GroovyMarkupConfig bean in this web application context " +
"(or its parent): GroovyMarkupConfigurer is the usual implementation. " +
"This bean may be given any name.");
}
GroovyMarkupRegistration registration = new GroovyMarkupRegistration();
this.viewResolvers.add(registration.getViewResolver());
return registration;
}
@Before
public void setUp() {
StaticWebApplicationContext context = new StaticWebApplicationContext();
context.registerSingleton("freeMarkerConfigurer", FreeMarkerConfigurer.class);
context.registerSingleton("velocityConfigurer", VelocityConfigurer.class);
context.registerSingleton("tilesConfigurer", TilesConfigurer.class);
context.registerSingleton("groovyMarkupConfigurer", GroovyMarkupConfigurer.class);
context.registerSingleton("scriptTemplateConfigurer", ScriptTemplateConfigurer.class);
this.registry = new ViewResolverRegistry();
this.registry.setApplicationContext(context);
this.registry.setContentNegotiationManager(new ContentNegotiationManager());
}
@Bean
public GroovyMarkupConfigurer groovyMarkupConfigurer() {
GroovyMarkupConfigurer configurer = new GroovyMarkupConfigurer();
configurer.setResourceLoaderPath("/WEB-INF/");
return configurer;
}
@Bean
public GroovyMarkupConfigurer groovyMarkupConfigurer() {
GroovyMarkupConfigurer configurer = new GroovyMarkupConfigurer();
configurer.setResourceLoaderPath("/WEB-INF/");
return configurer;
}
@Bean
public GroovyMarkupConfigurer groovyMarkupConfigurer() {
GroovyMarkupConfigurer configurer = new GroovyMarkupConfigurer();
configurer.setResourceLoaderPath("/groovy/");
return configurer;
}
@Bean
public GroovyMarkupConfigurer groovyMarkupConfigurer() {
GroovyMarkupConfigurer configurer = new GroovyMarkupConfigurer();
configurer.setResourceLoaderPath("/WEB-INF/");
return configurer;
}
@Bean
public GroovyMarkupConfigurer groovyMarkupConfigurer() {
GroovyMarkupConfigurer configurer = new GroovyMarkupConfigurer();
configurer.setResourceLoaderPath("/WEB-INF/views/");
return configurer;
}