英文:
Spring Tool Suite doesn't show new project in browser after delete the old one
问题
I had an old project in STS, then I deleted it and created the new one with the same project name. I create controller class showed below:
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class MainController {
@RequestMapping("/")
public String index() {
return "index";
}
@RequestMapping("login")
public String login() {
return "login";
}
}
I have .html file also: index.html and login.html
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>INDEX</title>
</head>
<body>
DANIEL---Index.
</body>
</html>
and
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>LOGIN</title>
</head>
<body>
DANIEL---Login.
</body>
</html>
What I expect to be showed in the browser is just DANIEL---index and DANIEL---login, but in fact, it showed the content of the old project:
Although I deleted the metadata folder and changed to another workplace, but it seems not to have any effect. Please help me.
I captured the STS screen:
英文:
I had an old project in STS, then I deleted it and created the new one with the same project name. I create controller class showed below:
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class MainController {
@RequestMapping("/")
public String index() {
return "index";
}
@RequestMapping("login")
public String login() {
return "login";
}
}
I have .html file also: index.html and login.html
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>INDEX</title>
</head>
<body>
DANIEL---Index.
</body>
</html>
and
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>LOGIN</title>
</head>
<body>
DANIEL---Login.
</body>
</html>
What I expect to be showed in browser is just DANIEL---index and DANIEL---login, but in fact, it showed the content of the old project:
Although I deleted metadata folder and change to another workplace, but it seems not effect. Please help me.
答案1
得分: 1
当您的类路径中存在spring-security时,它将自动设置重定向到登录页面,默认用户名为user
,默认密码将在启动时打印在控制台上。
您可以在application.properties中指定不同的密码:
spring.security.user.password=password
当然,您也可以从pom文件中删除spring-security依赖,登录页面将被移除。
或者,您可以按照这里的说明进行设置:https://www.baeldung.com/spring-boot-security-autoconfiguration
英文:
When you have spring-security in your classpath it will automatically set up redirect to login with the default username being user
and the default password will be printed in the console at the startup.
You can specify a different password in application.properties
spring.security.user.password=password
You can of course remove spring-security dependency from pom file and the login page will go away.
Or you can set it up like explained here https://www.baeldung.com/spring-boot-security-autoconfiguration
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论