error creating bean with name 'eurekaautoserviceregistration': singleton bean creation not a
package com.zhiyis.framework.service.tx; import com.codingapi.tx.netty.service.txmanagerhttprequestservice; import com.lorne.core.framework.utils.http.httputils; import lombok.extern.slf4j.slf4j; import org.springframework.stereotype.service; /** * create by lorne on 2017/11/18 */ @service @slf4j public class txmanagerhttprequestserviceimpl implements txmanagerhttprequestservice{ @override public string httpget(string url) { log.info("httpget-start"); string res = httputils.get(url); log.info("httpget-end"); return res; } @override public string httppost(string url, string params) { log.info("httppost-start"); string res = httputils.post(url,params); log.info("httppost-end"); return res; } }
package com.zhiyis.framework.service.tx; import com.codingapi.tx.config.service.txmanagertxurlservice; import lombok.extern.slf4j.slf4j; import org.springframework.beans.factory.annotation.value; import org.springframework.stereotype.service; /** * create by lorne on 2017/11/18 */ @service @slf4j public class txmanagertxurlserviceimpl implements txmanagertxurlservice { @value("${tm.manager.url}") private string url; @override public string gettxurl() { log.info("load tm.manager.url :{}", url); return url; } }
否则也会报上述错误
package com.zhiyis.framework.lock; import org.springframework.beans.beansexception; import org.springframework.beans.factory.config.beandefinition; import org.springframework.beans.factory.config.beanfactorypostprocessor; import org.springframework.beans.factory.config.configurablelistablebeanfactory; import org.springframework.stereotype.component; import java.util.arrays; @component public class feignbeanfactorypostprocessor implements beanfactorypostprocessor { @override public void postprocessbeanfactory(configurablelistablebeanfactory beanfactory) throws beansexception { if (containsbeandefinition(beanfactory, "feigncontext", "eurekaautoserviceregistration")) { beandefinition bd = beanfactory.getbeandefinition("feigncontext"); bd.setdependson("eurekaautoserviceregistration"); } } private boolean containsbeandefinition(configurablelistablebeanfactory beanfactory, string... beans) { return arrays.stream(beans).allmatch(b -> beanfactory.containsbeandefinition(b)); } }
参考 https://blog.csdn.net/lililuni/article/details/83105045
如对本文有疑问, 点击进行留言回复!!
浅谈Java如何实现一个基于LRU时间复杂度为O(1)的缓存
JDK1.6“新“特性Instrumentation之JavaAgent(推荐)
before社区电量是什么意思 Before社区电量获得方法
网友评论