(omitted 2000 word nonsense here), the first time to write a blog, directly into the topic.
From a beginner's point of view, the first step to using Spring-boot and spring-security-oauth2 integration is to build a "Hello world" to run first. So apart, first a spring-boot "Hello world".
This side dish uses the Idea+maven to build the project, assumes already has a basic maven-archetype-web structure,
About the structure of the directory of the architecture, everyone has their own views, the design of the idea is that the client sends the request, according to the "Web"-"Service"-"DAO" in order to interact with the database, generate "PO". The configuration of the framework is placed in "config", some DAO layers or other layers of encapsulation in "common", String, Excel and other tool classes in Util, "API" is provided to the external access interface layer, you can call "service", you can also call "Web".
Start by building a Spring-boot Web project.
1. Add Jar Package:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.0.RELEASE</version>
</parent>
Spring-boot is based on SPRING-MVC and therefore requires
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
Once the dependencies are successful, the required jar packages are shown in the external libraies, and the next quick and easy web development is on them.
2. Spring-boot Startup class
The main thing is to configure the @springbootapplication, which probably means to tell the Spring-boot program entrance here.
3. "Web" Access Layer Controller class
4. Start Spring-boot
You can start directly from App.class's Main method run or debug, or you can use the MVN spring-boot:run command to start
Input http://localhost:8080/home, test result:
Spring-boot & Spring-security-oauth2