玛文3中有一个新的DSL格式用于其POM。是不是有排序类似的格式弹簧applicationcontext.xml 文件?

StackOverflow https://stackoverflow.com/questions/3816077

  •  26-09-2019
  •  | 
  •  

在家3有新的DSL替代的舞.参见: http://polyglot.sonatype.org/groovy.html 对奇妙的简洁的语法。

是否有类似的东西,可使用弹簧applicationcontext.xml 文件?

有帮助吗?

解决方案

在弹簧3你可以使用基于Java容器的配置,看到 3.11Java基于容器的配置.它也扮演好 自动检测的部件.使用这些功能来代替 applicationContext.xml, 添加下面到 web.xml:

<context-param>
    <param-name>contextClass</param-name>
    <param-value>org.springframework.web.context.support.AnnotationConfigWebApplicationContext</param-value>
</context-param>

<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>
        ... package and class names to use for configuration ...
    </param-value>
</context-param>

你还可以配置 DispatcherServlet 以同样的方式-有 <init-param> 而不是的 <context-param>.

其他提示

看看杯弹BeanBuilder,提供一个"常规"办法的定义和结构的春季豆: http://www.grails.org/Spring+Bean+Builder

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top