mercredi 23 décembre 2020

Spring application starts with wrong page

Good daytime!

My App at start shows page from another project (that even not opened). After googling, i had already cleaned browser and set another server port in application.properties. Tried different browsers. Nothing changed.

Server has no errors. enter image description here

This is POM.

4.0.0 org.springframework.boot spring-boot-starter-parent 2.2.12.RELEASE com.example spring-security-jpa 0.0.1-SNAPSHOT spring-security-jpa Demo project for Spring Boot

<properties>
    <java.version>11</java.version>
</properties>

<dependencies>

    <!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <version>1.18.12</version>
        <scope>provided</scope>
    </dependency>


    <!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-devtools -->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
        <version>2.3.4.RELEASE</version>
    </dependency>


    <!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-thymeleaf -->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-thymeleaf</artifactId>
        <version>2.3.4.RELEASE</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>
    <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>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
        <exclusions>
            <exclusion>
                <groupId>org.junit.vintage</groupId>
                <artifactId>junit-vintage-engine</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-test</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

This is page.

    <!DOCTYPE html>
<html lang="en" xmlns:th="http://thymeleaf.org">
<head>
    <meta charset="ISO-8859-1">
    <title>Registration</title>
    <link rel="stylesheet"
          href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
          integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
          crossorigin="anonymous">
</head>
<body>

<!-- create navigation bar ( header) -->
<nav class="navbar navbar-inverse navbar-fixed-top">
    <div class="container">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed"
                    data-toggle="collapse" data-target="#navbar" aria-expanded="false"
                    aria-controls="navbar">
                <span class="sr-only">Toggle navigation</span> <span
                    class="icon-bar"></span> <span class="icon-bar"></span> <span
                    class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="#" th:href="@{/}">Registration and
                Login Module</a>
        </div>
    </div>
</nav>

<br>
<br>
<!-- Create HTML registration form -->
<div class="container">
    <div class="row">
        <div class="col-md-6 col-md-offset-3">

            <!-- success message -->
            <div th:if="${param.success}">
                <div class="alert alert-info">You've successfully registered!</div>
            </div>

            <h1>Registration</h1>

            <form th:action="@{/registration}" method="post" th:object="${user}">
                <div class="form-group">
                    <label class="control-label" for="firstName"> First Name </label>
                    <input id="firstName" class="form-control" th:field="*{firstName}"
                           required autofocus="autofocus" />
                </div>

                <div class="form-group">
                    <label class="control-label" for="lastName"> Last Name </label> <input
                        id="lastName" class="form-control" th:field="*{lastName}"
                        required autofocus="autofocus" />
                </div>

                <div class="form-group">
                    <label class="control-label" for="email"> Email </label> <input
                        id="email" class="form-control" th:field="*{email}" required
                        autofocus="autofocus" />
                </div>

                <div class="form-group">
                    <label class="control-label" for="password"> Password </label> <input
                        id="password" class="form-control" type="password"
                        th:field="*{password}" required autofocus="autofocus" />
                </div>

                <div class="form-group">
                    <button type="submit" class="btn btn-success">Register</button>
                    <span>Already registered? <a href="/" th:href="@{/login}">Login
                                here</a></span>
                </div>
            </form>
        </div>
    </div>
</div>
</body>
<head/>

Please help.




Aucun commentaire:

Enregistrer un commentaire