标签: spring-lemon

Spring柠檬BeanCurrentlyInCreationException:创建bean时出错

我正在尝试遵循这个 spring-lemon 入门教程(https://naturalprogrammer.gitbooks.io/spring-lemon-getting-started/content/index.html),但在某个时刻我无法进一步进行。我创建了一个新的 spring 启动项目(Spring boot),并且我能够向其中添加 spring 柠檬。除了按照说明进行操作之外,我什么也没做,但是当我开始 Maven 构建时,测试失败并出现以下错误:

org.springframework.beans.factory.BeanCreationException:创建名称为“lmnDemoController”的bean时出错:自动装配依赖项注入失败;嵌套异常是 org.springframework.beans.factory.BeanCreationException:无法自动装配方法:public void com.naturalprogrammer.spring.lemon.LemonController.setLemonService(com.naturalprogrammer.spring.lemon.LemonService); 嵌套异常是 org.springframework.beans.factory.BeanCurrentlyInCreationException:创建名称为“lmnDemoService”的 bean 时出错:名称为“lmnDemoService”的 Bean 已作为循环引用的一部分注入其原始版本中的其他 bean [authenticationSuccessHandler],但已注入最终被包裹。这意味着所述其他 bean 不使用该 bean 的最终版本。这通常是过度渴望类型匹配的结果 - 例如,考虑使用“getBeanNamesOfType”并关闭“allowEagerInit”标志。

我的LmnDemoService.java是:

package com.example;

import org.springframework.stereotype.Service;
import com.naturalprogrammer.spring.lemon.LemonService;

@Service
public class LmnDemoService extends LemonService<User, Long> { 
    @Override
    protected User newUser() {
        return new User();
    }
}
Run Code Online (Sandbox Code Playgroud)

它没有任何其他内容,只是教程中所说的几行内容。我缺少什么?

编辑:

LmndemoApplication.java

package com.example;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import com.naturalprogrammer.spring.lemon.LemonConfig;

@SpringBootApplication(scanBasePackageClasses = {LmndemoApplication.class, LemonConfig.class})
public class LmndemoApplication {

    public static void main(String[] …
Run Code Online (Sandbox Code Playgroud)

java spring spring-mvc spring-boot spring-lemon

2
推荐指数
1
解决办法
3791
查看次数

标签 统计

java ×1

spring ×1

spring-boot ×1

spring-lemon ×1

spring-mvc ×1