SpringBootばかりでXMLConfigurationのサンプルがない!
SpringBootがメインになってくるとConfiguration
クラスを作成してAnnotation
ベースで定義する場合が多いと思いますが、SpringMVCの場合はどうやって書いたらいいねん!で検証してみたので。
結論からいうと以下
applicationContext.xmlまたはspring-security.xmlまたはoauth-client.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:sec="http://www.springframework.org/schema/security"
xmlns:oauth2="http://www.springframework.org/schema/security/oauth2"
xsi:schemaLocation="
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/security/oauth2 http://www.springframework.org/schema/security/spring-security-oauth2.xsd
">
<!-- client, resourceなどは省略 -->
<oauth2:rest-template id="oauth2RestTemplate" resource="grantResource" access-token-provider="tokenProvider">
<property name="interceptors">
<list>
<ref bean="requestResponseLoggingInterceptor" />
</list>
</property>
</oauth2:rest-template>
xsdの見方がわからず1時間ほどやられた、、、
@Bean
の書き方は思い出したら書くかも