2017-09-19 6 views
1

Il y a une méthode de service Web annoté @Preautorizeprintemps el: des problèmes avec les paramètres

@PreAuthorize("principal.somePrincipalMethod(#request.property1, #request.property2, 'stringA', 'stringB')") 
public SomeResponse someWebServiceMethod(SomeRequest request) { 
... 
} 
public class SomeRequest { 
    Long property1; 
    Long property2; 
} 

Et il y a deux méthodes de classe surchargées met en œuvre UserDetails

public boolean somePrincipalMethod(Long longParam1, Long longParam2, String... stringParams) { 
    return true; 
} 
public boolean somePrincipalMethod(Long longParam, String... stringParams) { 
    return true; 
} 

Quand j'appelle someWebServiceMethod je reçois somePrincipalMethod(Long longParam, String... stringParams) pas somePrincipalMethod(Long longParam1, Long longParam2, String... stringParams)

Qu'est-ce que je fais de mal?

Répondre

0

J'ai trouvé une solution (solution de contournement).

@PreAuthorize("principal.somePrincipalMethod(#request.property1, #request.property2, {'stringA', 'stringB'})") 
public SomeResponse someWebServiceMethod(SomeRequest request) { 
... 
} 
public boolean somePrincipalMethod(Long longParam1, Long longParam2, String[] stringParams) { 
    return true; 
} 
public boolean somePrincipalMethod(Long longParam, String[] stringParams) { 
    return true; 
}