SpringBoot: Difference between revisions

From Wiki RB4
Line 2: Line 2:
* SpringBoot Autoconfiguration
* SpringBoot Autoconfiguration
* Dispatcher Servlet
* Dispatcher Servlet
* Security
===Security===
adding to <code>pom.xml</code>:
<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-security</artifactId>
</dependency>
and update the project automatically sets up form-based authentication with
* user='user
* pwd=see console output of server start


==Configuration==
==Configuration==

Revision as of 21:24, 16 February 2021

Concepts

  • SpringBoot Autoconfiguration
  • Dispatcher Servlet

Security

adding to pom.xml:

<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-security</artifactId>
</dependency>

and update the project automatically sets up form-based authentication with

  • user='user
  • pwd=see console output of server start

Configuration

\test1\src\main\resources\applircation.properties
  logging.level.org.springframework = debug

Implementation

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@CrossOrigin(origins="http://localhost:4200") // avoid cross origin errors in browser
public class HelloWorldController 
{
  // @RequestMapping(method=RequestMethod.GET, path="/hello-world")
  @GetMapping(path="/hello-world")

Examples

  • start eclipse
  • File -> Import -> Maven Project