In spring boot, application.yml takes in the Spring oauth2 client config. How do I configure it for the non-boot application. By configuration I mean giving client ID, secret, scopes and redirect URI.
2 Answers
If you don't use SpringBoot : there is no application.yml and even if you can add the support of yml files. It won't handle your oauth2 client config.
Anyway you can use Spring security to implement your custom Authorization Service, a User service and implement a Token Store of your choice (JBDCTokenStore or JWTTokenStore for example). But It's a very wide question depending on your business logic.
You can find some well documented samples on : https://github.com/spring-projects/spring-security-oauth/tree/master/spring-security-oauth2
Of course you can handle both XML and javaConfig even mixed Spring confugurations. Create a @Configuration class with a @ComponentScan on the packages containing components or bean definitions.
@Configuration
@ComponentScan({ "com.firm.product.config.xml","com.firm.product.config.java" })
public class SpringConfig {
}
You can also set properties with @PropertySource() ans @Value annotations. It's very well documented.

- 629
- 4
- 14
-
can we handle client config with xml or java native config . if yes can you share any example ? – Dheeraj Jul 23 '20 at 18:33
You could find an example here:
https://www.baeldung.com/spring-security-5-oauth2-login#non-boot
You need to:
- Build your
ClientRegistration
. - A
ClientRegistrationRepository
. - Register your repository on
WebSecurityConfigurerAdapter
.

- 209
- 2
- 9