Spring-boot @ConfigurationProperties未加载

时间:2018-01-19 03:14:30

标签: spring spring-boot

我是中国人,我的英语非常差,但我有一个关于春靴的问题,我在中国找不到答案,希望有人能帮帮我!!

我有Pojo ShiroFilterChainMap

@ConfigurationProperties(prefix = ShiroFilterChainMap.PREFIX)
public class ShiroFilterChainMap {
    public static final String PREFIX = "shiro.filter.chain";
    public LinkedHashMap<String, String> map;
    ...
}

在下面,它是我的配置

@Configuration
@EnableConfigurationProperties(ShiroFilterChainMap.class)
public class ShiroConfig {
    private ShiroFilterChainMap shiroFilterChainMap;
    public ShiroConfig(ShiroFilterChainMap shiroFilterChainMap) {
        this.shiroFilterChainMap = shiroFilterChainMap;
    }
    ...
}

META-INF - &gt; spring.factories

org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.shiwen.shiro.ShiroConfig

接下来,另一个项目依赖于项目,在启动时抛出异常

Caused by: java.lang.NoSuchMethodException: com.shiwen.shiro.ShiroConfig$$EnhancerBySpringCGLIB$$a56527fa.<init>()
    at java.lang.Class.getConstructor0(Class.java:3082)
    at java.lang.Class.getDeclaredConstructor(Class.java:2178)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:80)
    ... 33 more

如果使用setter DI,它也会出错,注入的属性为null,

在上面这是我的问题,我希望有人帮助我,谢谢!!

0 个答案:

没有答案