Spring-boot & Spring-security-oauth2

Source: Internet
Author: User

(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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.