[英]Spring web-app annotation driven - How to configure? (Best Practice)
I'm developing bunch of relatively small Spring based java web-application. 我正在开发一堆相对较小的基于Spring的Java Web应用程序。 I'm mostly using annotations to create controllers and components. 我主要使用注释来创建控制器和组件。 What's the best way to configure such application? 配置此类应用程序的最佳方法是什么?
I'm writing my own "configuration beans" that are just value beans with needed fields and @autowire them into other beans 我正在编写自己的“配置bean”,它们只是具有所需字段的值bean,然后将它们@autowire插入其他bean
this way my config.xml contains of "just" component-scan and definition of config-beans (2-3 per app) 这样我的config.xml包含“just”组件扫描和config-beans的定义(每个应用程序2-3个)
Is this good approach? 这是好方法吗?
There is nothing wrong with this approach. 这种方法没有错。 Folks prefer it this way. 人们更喜欢这种方式。 So, go with it, I would say. 所以,我会说,顺其自然。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.