创建名称为'requestMappingHandlerAdapter'的Spring Boot时出错

低语暗语:

我正在Spring Boot应用程序中创建一个接口,但是当我在该接口中放置一个方法时,该应用程序就会崩溃...我看到其他主题都在谈论此错误,但找不到一个好的解决方案。

这是我的接口-> CategorieNamespaceRepository:

package com.ent.intra.devops.accessingdatamysql;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;

import com.ent.intra.devops.getterclasses.CategorieNamespace;


@Repository
public interface CategorieNamespaceRepository extends CrudRepository<CategorieNamespace, Integer> {
    CategorieNamespace findByNamespace(String namespacename);
}

CategorieNamespace类:

package com.ent.intra.devops.getterclasses;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
@Table(name = "categorienamespaces")
public class CategorieNamespace {
    @Id
    @GeneratedValue

  private Integer id;
  private String namespacename;
  private String dateajout;

    public Integer getId() {
        return id;
    }
    public void setId(Integer id) {
        this.id = id;
    }
    public String getNamespacename() {
        return namespacename;
    }
    public void setNamespacename(String namespacename) {
        this.namespacename = namespacename;
    }
    public String getDateajout() {
        return dateajout;
    }
    public void setDateajout(String dateajout) {
        this.dateajout = dateajout;
    }


}

还有我的pom文件:

<?xml version="1.0" encoding="UTF-8"?>
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.2.2.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.ent.intra.devops</groupId>
    <artifactId>api-beluga</artifactId>
    <version>1.0.0</version>
    <name>app</name>
    <description>app</description>

    <properties>
        <java.version>1.8</java.version>
        <!--  <start-class>com.ent.intra.devops.MainApiSpring</start-class> -->
        <junit.jupiter.version>5.5.2</junit.jupiter.version>
    </properties>

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

        <!--  Count the number of a character with this library -->
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            </dependency>

            <dependency>
                <groupId>org.junit.jupiter</groupId>
                <artifactId>junit-jupiter-api</artifactId>  
            </dependency>

            <dependency>
                <groupId>org.junit.jupiter</groupId>
                <artifactId>junit-jupiter-engine</artifactId>

            </dependency>



        <dependency>
    <groupId>com.google.code.gson</groupId>
    <artifactId>gson</artifactId>
        </dependency>

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

        <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-jpa</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>junit</groupId>
                    <artifactId>junit</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>           
            <scope>test</scope>
        </dependency>

        <dependency>
  <groupId>org.junit.vintage</groupId>
  <artifactId>junit-vintage-engine</artifactId>
  <scope>test</scope>
</dependency>


        <dependency>
    <groupId>org.apache.httpcomponents</groupId>
    <artifactId>httpclient</artifactId>
    </dependency>
    </dependencies>



    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>                    
                    <compilerArgs>
                        <arg>Dserver.port=8080</arg>                        
                     </compilerArgs>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>

没有以下行,该错误不会出现: CategorieNamespace findByNamespace(String namespacename);

完全错误:

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'requestMappingHandlerAdapter' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Unsatisfied dependency expressed through method 'requestMappingHandlerAdapter' parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mvcConversionService' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.format.support.FormattingConversionService]: Factory method 'mvcConversionService' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'categorieNamespaceRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Failed to create query for method public abstract com.ent.intra.devops.getterclasses.CategorieNamespace com.ent.intra.devops.accessingdatamysql.CategorieNamespaceRepository.findByNamespace(java.lang.String)! No property namespace found for type CategorieNamespace!

感谢帮助 :)

罗诺:

实体中没有namespaceCategorieNamespace,这就是为什么错误说

No property namespace found for type CategorieNamespace

可能是你试图通过寻找namespacenameCategorieNamespacefindByNamespacename()在存储库中使用

@Repository
public interface CategorieNamespaceRepository extends CrudRepository<CategorieNamespace, Integer> {
    CategorieNamespace findByNamespacename(String namespacename);
}

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

创建名称为'requestMappingHandlerAdapter'的bean时出错

UnsatisfiedDependencyException:创建名称为'requestMappingHandlerAdapter'的bean时出错

@SpringBootTest创建名称为'requestMappingHandlerAdapter'的bean时出错

Spring Boot-创建名称为'jmsConnectionFactory'的bean时出错

Spring Boot错误:创建名称为“ entityManagerFactory”的bean时出错

在Spring Boot中创建名称为'batchConfigurer'的bean时出错

创建名称为'roleRepository'的Java Spring Boot时出错

我为我的Spring Boot应用程序获取了“在类路径资源中定义名称为'requestMappingHandlerAdapter'的bean创建错误”

如何使用Spring Boot Security修复Spring Boot Webflux应用中的'名称为requestMappingHandlerAdapter的无效Bean定义'错误

使用Spring Boot时在类路径资源中定义名称为'entityManagerFactory'的bean创建时出错

Spring-boot和spring-data-jpa Mysql:创建名称为'entityManagerFactory'的bean时出错

具有Spring Security的Spring Boot:创建名称为“ securityFilterChainRegistration”的bean时出错

Spring Boot Test-创建名称为SpringBootRepositoryRestMvcConfiguration的bean时出错

Spring Boot-在类路径资源中创建名称为'dataSource'的bean时出错

运行spring boot build:在类路径中创建名称为'entityManagerFactory'的bean时出错

Spring Boot 2.1.1到2.1.2:创建名称为'payloadRootAnnotationMethodEndpointMapping'的bean时出错

需要帮忙!Spring Boot错误:不满意的DependancyException:创建名称为''的bean时出错

在Spring Boot中创建在类路径资源中定义的名称为'redisson'的bean时出错

在Spring Boot App中创建名称为'liquibase'的bean时出错

在spring-boot中使用kotlin暂停功能创建名称为'requestMappingHandlerMapping'的bean时出错

Kotlin Spring Boot Gradle - 创建名称为“resourceHandlerMapping”的 bean 时出错 - 未设置 ServletContext

创建文件 Spring Boot 中定义的名称为“postsController”的 bean 时出错

在TomEE上部署Spring Boot应用程序时出错:UnsatisfiedDependencyException:创建名称为'employeeController'的bean时出错

Spring Boot:+ Spring Data Rest:在类路径资源中定义名称为“entityManagerFactory”的 bean 创建时出错

由于创建名称为adminHandlerMapping的bean时出错,Spring-Boot-Admin应用程序无法启动

在JBoss EAP 7.1.0中部署Spring Boot应用程序时,创建名称为“ undertowServletWebServerFactory”的bean时出错

导致原因:org.springframework.beans.factory.BeanCreationException:使用 Spring Boot 2 创建名称为错误的 bean 时出错

在Weblogic BeanCreationException中部署Spring Batch时出错:创建名称为'jobRepository'的bean时出错

Spring Boot错误创建名称为'optionalLiveReloadServer'的bean