Test Spring REST service with Spring security on SoapUI -
i'm have spring service this:
localhost:8889/projectx/insurance/?policy=1
@restcontroller @requestmapping(value="insurance") public class insuranceservice {              @requestmapping(value="/", method=requestmethod.get, produces = mediatype.application_json_value)             public list<policy> getpolicy(@requestparam(value="policy") int policy){            ...     }  } that produces json policy info.
in websecurityconfig.java have security:
       @override         protected void configure(httpsecurity http) throws exception {             http             .authorizerequests()             .antmatchers("/insurance/**").access("hasrole('advicer')")             ... so if try consume service on soapui directed login form
i switch off security junit testing, profile.
in websecurityconfig.java file add
@profile("default") then non security testing either in junit use
@activeprofiles("test") or server add server start up
-dspring.profiles.active=test 
Comments
Post a Comment