@@ -86,28 +86,14 @@ public final class AuthorizationAdvisorProxyFactory
86
86
private static final TargetVisitor DEFAULT_VISITOR_SKIP_VALUE_TYPES = TargetVisitor .of (new ClassVisitor (),
87
87
new IgnoreValueTypeVisitor (), DEFAULT_VISITOR );
88
88
89
- private List <AuthorizationAdvisor > advisors = new ArrayList <>() ;
89
+ private List <AuthorizationAdvisor > advisors ;
90
90
91
91
private TargetVisitor visitor = DEFAULT_VISITOR ;
92
92
93
- /**
94
- * Construct an {@link AuthorizationAdvisorProxyFactory} with the following advisors
95
- * @param advisors the list of advisors to wrap around proxied objects
96
- * @since 6.4
97
- */
98
- public AuthorizationAdvisorProxyFactory (List <AuthorizationAdvisor > advisors ) {
99
- this .advisors .addAll (advisors );
100
- AnnotationAwareOrderComparator .sort (this .advisors );
101
- }
102
-
103
- /**
104
- * Construct an {@link AuthorizationAdvisorProxyFactory} with the following advisors
105
- * @param advisors the list of advisors to wrap around proxied objects
106
- * @since 6.4
107
- */
108
- public AuthorizationAdvisorProxyFactory (AuthorizationAdvisor ... advisors ) {
109
- this .advisors .addAll (List .of (advisors ));
110
- AnnotationAwareOrderComparator .sort (this .advisors );
93
+ private AuthorizationAdvisorProxyFactory (List <AuthorizationAdvisor > advisors ) {
94
+ this .advisors = new ArrayList <>(advisors );
95
+ this .advisors .add (new AuthorizeReturnObjectMethodInterceptor (this ));
96
+ setAdvisors (this .advisors );
111
97
}
112
98
113
99
/**
@@ -122,9 +108,7 @@ public static AuthorizationAdvisorProxyFactory withDefaults() {
122
108
advisors .add (AuthorizationManagerAfterMethodInterceptor .postAuthorize ());
123
109
advisors .add (new PreFilterAuthorizationMethodInterceptor ());
124
110
advisors .add (new PostFilterAuthorizationMethodInterceptor ());
125
- AuthorizationAdvisorProxyFactory proxyFactory = new AuthorizationAdvisorProxyFactory (advisors );
126
- proxyFactory .addAdvisors (new AuthorizeReturnObjectMethodInterceptor (proxyFactory ));
127
- return proxyFactory ;
111
+ return new AuthorizationAdvisorProxyFactory (advisors );
128
112
}
129
113
130
114
/**
@@ -139,9 +123,7 @@ public static AuthorizationAdvisorProxyFactory withReactiveDefaults() {
139
123
advisors .add (AuthorizationManagerAfterReactiveMethodInterceptor .postAuthorize ());
140
124
advisors .add (new PreFilterAuthorizationReactiveMethodInterceptor ());
141
125
advisors .add (new PostFilterAuthorizationReactiveMethodInterceptor ());
142
- AuthorizationAdvisorProxyFactory proxyFactory = new AuthorizationAdvisorProxyFactory (advisors );
143
- proxyFactory .addAdvisors (new AuthorizeReturnObjectMethodInterceptor (proxyFactory ));
144
- return proxyFactory ;
126
+ return new AuthorizationAdvisorProxyFactory (advisors );
145
127
}
146
128
147
129
/**
@@ -179,21 +161,13 @@ public Object proxy(Object target) {
179
161
return factory .getProxy ();
180
162
}
181
163
182
- public void addAdvisors (AuthorizationAdvisor ... advisors ) {
183
- this .advisors .addAll (List .of (advisors ));
184
- AnnotationAwareOrderComparator .sort (this .advisors );
185
- }
186
-
187
164
/**
188
165
* Add advisors that should be included to each proxy created.
189
166
*
190
167
* <p>
191
168
* All advisors are re-sorted by their advisor order.
192
169
* @param advisors the advisors to add
193
- * @deprecated Either use the constructor to provide a complete set of advisors or use
194
- * {@link #addAdvisors(AuthorizationAdvisor...)} to add to the existing list
195
170
*/
196
- @ Deprecated
197
171
public void setAdvisors (AuthorizationAdvisor ... advisors ) {
198
172
this .advisors = new ArrayList <>(List .of (advisors ));
199
173
AnnotationAwareOrderComparator .sort (this .advisors );
@@ -205,10 +179,7 @@ public void setAdvisors(AuthorizationAdvisor... advisors) {
205
179
* <p>
206
180
* All advisors are re-sorted by their advisor order.
207
181
* @param advisors the advisors to add
208
- * @deprecated Either use the constructor to provide a complete set of advisors or use
209
- * {@link #addAdvisors(AuthorizationAdvisor...)} to add to the existing list
210
182
*/
211
- @ Deprecated
212
183
public void setAdvisors (Collection <AuthorizationAdvisor > advisors ) {
213
184
this .advisors = new ArrayList <>(advisors );
214
185
AnnotationAwareOrderComparator .sort (this .advisors );
0 commit comments