简体   繁体   中英

Issue in running spring project in sts spring boot

I am getting the below warning in running spring boot application in sts spring tool suite

>WARNING: An illegal reflective access operation has occurred
>WARNING: Illegal reflective access by org.springframework.cglib.core.ReflectUtils$1 (file:/home/imart/.m2/repository/org/springframework/spring-core/5.0.7.RELEASE/spring-core-5.0.7.RELEASE.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
>WARNING: Please consider reporting this to the maintainers of org.springframework.cglib.core.ReflectUtils$1
>WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
>WARNING: All illegal access operations will be denied in a future release

My code is below.

package com.search;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Hello world!
 *
 */
@RestController
@EnableAutoConfiguration
public class App 
{
    @RequestMapping("/tools/related_info")

    public String index() {
        return "Hello How are you";
    }

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

And my pom.xml as

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.indiamart</groupId>
  <artifactId>tools</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>war</packaging>

  <name>tools</name>
  <url>http://maven.apache.org</url>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.3.RELEASE</version>
</parent>
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>

<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-web -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
  </dependencies>
</project>

Spring Boot 2.0.x and Spring Framework 5.0.x are not supported on Java 11. If you want to use Java 11, you should upgrade to Spring Boot 2.1.x. This will also upgrade to Spring Framework 5.1.x.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM