Application with Tomcat and Spring Boot

Asked

Viewed 1,376 times

2

Hello!

I am having following problem in my application. After running the main method just below and enter in the browser the address of my application localhost:9090/restaurantWeb is opening a popup asking for user and password, I thought it would be from Tomcat, but my Tomcat was installed without user and password. If anyone has been there and can help!

@SpringBootApplication()
public class Application {

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }
}

Popup that appears in the browser, error in the background and after clicking cancel

inserir a descrição da imagem aqui

  • 1

    Hello. Spring Boot starts with its own Tomcat by default, otherwise it does not run this method main presented in the question. If you say you installed another Tomcat and are running the main, So you have two different Tomcats, one empty and the other with Spring Boot. What you need to do is pay attention to the Spring Boot boot log, as it will tell you which address is initialized. If you cannot solve, please edit your question by adding more details about this Tomcat and also the log, otherwise you cannot guess the problem. Hug!

  • Okay, thank you utluiz.

4 answers

2

This message is displayed when authentication Http Basic is active through Spring Security, unlike the other answers, you should not remove the dependency on your project, since it may be valid in the future and the problem will come back.

To actually solve the problem, you must configure Spring to disable authentication Http Basic, for this add the following line to the file application.properties:

security.basic.enabled=false

2

Probably in your file pom.xml you are with the following dependency:

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

This dependency is part of the package Spring Security which is used for user control and other things. To understand how to use Spring Security in your application, click here.

0

You probably have the Spring Security dependency on your pom.xml

Just remove this dependency and run the project again.

0

I believe you have a dependency on spring-security in your project.

According to the spring boot documentation, if you have spring-security on your classpath, spring-boot will automatically configure your project with Basic.

If Spring Security is on the classpath then web Applications will be Secure by default with ?basic' Authentication on all HTTP endpoints.

Take a look here.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.