当我通过Spring Boot和访问权限部署Spring应用程序时,localhost:8080
我必须进行身份验证,但是用户名和密码是什么或如何设置呢?我试图将其添加到我的tomcat-users
文件中,但是没有用:
<role rolename="manager-gui"/>
<user username="admin" password="admin" roles="manager-gui"/>
这是应用程序的起点:
@SpringBootApplication
public class Application extends SpringBootServletInitializer {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(Application.class);
}
}
这是Tomcat依赖项:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
我如何认证localhost:8080
?