मैंने सुझाए गए तरीकों का प्रयास किया है, मैंने आखिरकार निम्नलिखित काम किया है
अपने वेब एक्सएमएल में इन परिवर्तनों जोड़ा
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<servlet-mapping>
<servlet-name>service</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
अपने वसंत-सुरक्षा एक्सएमएल में इन परिवर्तनों जोड़े
<security:authentication-manager alias="authenticationManager">
<security:authentication-provider>
<security:user-service>
<security:user name="${resource.service.authentication.name}"
authorities="${resource.service.authentication.authorities}"
password="${resource.service.authentication.password}"/>
</security:user-service>
</security:authentication-provider>
</security:authentication-manager>
आपके आवेदन संदर्भ एक्सएमएल में इन परिवर्तनों को जोड़ें या आपके पास प्रॉपर्टी-लोडर एक्सएमएल अगर यहां तक कि बेहतर
<bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="placeholderPrefix" value="${" />
<property name="placeholderSuffix" value="}" />
<property name="locations">
<list>
<value>classpath:resourceservice.properties</value>
</list>
</property>
</bean>
फिर इन गुणों को अपनी संपत्ति फ़ाइल संसाधन में जोड़ें service.properties
memberservice.authentication.name=usename
memberservice.authentication.authorities=AUTHORISED
memberservice.authentication.password=password
आप संसाधन जर्सी
@PUT
@Path("{accountId}")
@Consumes("application/xml")
@PreAuthorize("hasRole('AUTHORISED')")
public Response methodName
स्रोत
2014-06-12 10:42:56
गया कोई भी लिंक/उदाहरण? क्षमा करें, मैं वसंत के लिए काफी नया हूँ। – Bhushan