1
기본 스프링 부팅 RESTful 응용 프로그램이 작동하지만 spring-boot-starter-security을 사용하여 권한을 추가하려고하면 암호가 콘솔에 인쇄되지 않습니다. 관련 파일의 내용은 다음과스프링 부트 보안 암호가 인쇄되지 않음
application.properties
logging.file=route.log
logging.level.org.springframework.web=ERROR
logging.level.org.springframework.boot.test=ERROR
logging.level.org.springframework.boot.autoconfigure.security=INFO
의 pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.be.test</groupId>
<artifactId>testName</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.2.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<start-class>com.be.test.TestNameApplication</start-class>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.maps/google-maps-services -->
<dependency>
<groupId>com.google.maps</groupId>
<artifactId>google-maps-services</artifactId>
<version>0.1.17</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.5</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
컨트롤러 클래스
package com.be.test.api;
@RestController
public class TestController {
@RequestMapping(value = "/test", method=RequestMethod.GET)
public
@ResponseBody
long test() {
return 1000;
}
}
파일의 누락 아무것도 17,451,515,
Main 클래스
package com.be.test;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.ComponentScan;
@SpringBootApplication()
@ComponentScan
@EnableAutoConfiguration
public class TestNameApplication {
public static void main(String[] args) throws Exception {
ApplicationContext ctx = SpringApplication.run(TestNameApplication.class, args);
}
}
있습니까?
코드에 암호를 인쇄하는 문장이 표시되지 않습니다. 비밀 암호를 인쇄하는 것이 유용할까요? ;-) – JimHawkins
@JimHawkins Spring Boot는 정상적으로 자동으로이 작업을 수행합니다. BlueEagle : application.properties를 사용하여 비밀번호를 설정하는 방법은 무엇입니까? – Marged
@Marged 시도했지만 여전히 작동하지 않습니다. 어떤 사용자 이름/암호 없이도 요청 (컬 및 우편 배달부)을 보내면 성공적으로 실행됩니다. – BlueEagle