如何将Spring bean Oauth集成从XML转换为基于Java注释的Config

时间:2018-05-21 08:49:00

标签: java xml spring javabeans spring-java-config

我想为我的Rest api实现安全性,在这里我的问题是,我有这个基于xml的配置。但在我的项目中,我想使用基于java注释的配置。如何将基于xml的配置转换为基于java的配置?下面的代码是基于xml的配置,提前感谢所有帮助。

|-------+-------|
| name  | cats  |
|-------+-------|
| xyzzy | a b c |
| plugh | b     |
| quux  |       |
| quuux | a c   |
|-------+-------|

1 个答案:

答案 0 :(得分:0)

您可以保留xml配置并将其导入java基本配置,如下所示:

@Configuration
@ImportResource(value="path/to/xml")
public class SecurityConfiguration{
  //additionnal configurations here
}

我认为这是最好的方法。