简体   繁体   English

带有 Tapestry 配置的 Spring-boot

[英]Spring-boot with Tapestry configuration

Does anyone have any reference project with Spring-boot and Tapestry5?有人有 Spring-boot 和 Tapestry5 的参考项目吗? I can't seem to find any samples.我似乎找不到任何样本。 I have diificulties in configuring the tapestry bean & Context using a @configuration class without an web.xml.我在使用没有 web.xml 的 @configuration 类配置挂毯 bean 和上下文方面遇到了困难。

I've been looking for such an example myself, and I happen to have found one today:我自己一直在寻找这样的一个例子,今天我碰巧找到了一个:

https://github.com/code8/tapestry-boot https://github.com/code8/tapestry-boot

The tapestry-boot library implements following features: Tapestry-boot库实现了以下功能:

  • bootstraps tapestry framework inside embedded servlet container managed by spring-boot在由spring-boot管理的嵌入式 servlet 容器内引导 Tapestry 框架

  • provides injection of spring-services into tapestry-services将 spring-services 注入 Tapestry-services

  • provides injection of tapestry-services into spring-services将 Tapestry-services 注入 spring-services

To use tapestry-boot simple marks tapestry application module with @TapestryApplication annotation.要使用tapestry-boot简单标记tapestry 应用程序模块和@TapestryApplication 注解。

See DemoApplicationTests.请参阅演示应用程序测试。

This works for me:这对我有用:

Register TapestrySpringFilter注册TapestrySpringFilter

    @Bean
public FilterRegistrationBean tapesSpringFilter() {
    FilterRegistrationBean registration = new FilterRegistrationBean();
    registration.setFilter(new TapestrySpringFilter());
    registration.setName("app");
    registration.setDispatcherTypes(EnumSet.allOf(DispatcherType.class));
    return registration;
}

Add context aprameters to application.yml将上下文参数添加到application.yml

server:
  context_parameters:
    tapestry:
      use-external-spring-context: true
      app-package: com.test.admin
      development-modules: ...
      qa-modules: ...

I also had to use executable War to avoid problems with loading static files.我还必须使用可执行的 War 来避免加载静态文件时出现问题。

Perhaps this approach will not allow you to access the tapestry beans from the spring context.也许这种方法不允许您从 spring 上下文中访问挂毯 bean。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM