SpringBoot项目启动后访问网页显示“Please sign in“

SpringBoot启动类代码如下

SpringBoot项目启动后访问网页显示"Please sign in",如图

这是一个安全拦截页面,即SpringSecurity认证授权页面,因为SecurityAutoConfiguration是Spring Boot提供的安全自动配置类,也就是说它自动集成了SpringSecurity。

解决方法:

        因为是自动集成了SpringSecurity,因此我们可以禁用Security的自动配置,在启动类@SpringBootApplication注解上加上如下代码

@SpringBootApplication(exclude = {SecurityAutoConfiguration.class, SecurityFilterAutoConfiguration.class})

再次启动项目,访问页面,如图

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
将Spring Boot项目打包成exe文件的步骤如下: 1. 在pom.xml文件中添加以下插件: ``` <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.6.0</version> <executions> <execution> <id>build-exe</id> <phase>package</phase> <goals> <goal>exec</goal> </goals> <configuration> <executable>cmd</executable> <arguments> <argument>/c</argument> <argument>start</argument> <argument>/wait</argument> <argument>cmd.exe</argument> <argument>/c</argument> <argument>mvn clean package</argument> </arguments> </configuration> </execution> </executions> </plugin> </plugins> </build> ``` 2. 在项目根目录下创建一个.bat文件,文件名可以自定义,例如:build.bat。在文件中添加以下内容: ``` @echo off setlocal set JAR_NAME=your-project-name.jar set EXE_NAME=your-project-name.exe set DIR_NAME=target set JAR_PATH=%DIR_NAME%\%JAR_NAME% set EXE_PATH=%DIR_NAME%\%EXE_NAME% if exist %EXE_PATH% del %EXE_PATH% if exist %JAR_PATH% ( echo Building executable... echo. echo Please wait... echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值