如何發布hsf服務
感覺這個hsf需要pandora環境,所以...先導依賴
org.springframework.bootgroupid>
spring-boot-dependenciesartifactid>
1.5.9.releaseversion>
pomtype>
importscope>
dependency>
com.taobao.pandoragroupid>
pandora-boot-starter-bomartifactid>
2018-01-releaseversion>
pomtype>
importscope>
dependency>
dependencies>
dependencymanagement>
配置...
com.alibaba.bootgroupid>
pandora-hsf-spring-boot-starterartifactid>
dependency>
publicspring.hsf.group=hsf
spring.hsf.version=1.0.0.daily
spring.hsf.timeout=3000
class
}編寫你的hsf服務, 只需要在要發布的服務實現上新增@hsfprovider
, 其中serviceinte***ce
是要發布服務的介面:
可以使用@hsfprovider(serviceinte***ce = demoservice.class)
public
class
demoserviceimpl
implements
demoservice
{}
@hsfprovider
為特定的服務覆蓋全域性預設配置, 如:
@hsfprovider(serviceinte***ce = demoservice.class, servicegroup = "hsf", serviceversion = "1.0.1", clienttimeout = 500)
public
class
demoserviceimpl
implements
demoservice
{}
@hsfprovider
中的servicegroup
和serviceversion
以及其他 string 型別的配置都可以支援 spring 的 property placeholder, 如:
@hsfprovider(serviceinte***ce = demoservice.class, servicegroup = "$")
public
class
demoserviceimpl
implements
demoservice
{}
注意:spring boot預設只掃瞄main函式所在的package。如果服務是在其它的package裡,需要配置然後呢...就是消費這個服務了@componentscan
。
@componentscan(basepackages = "com.taobao.mypackage")
啟動類要配置註解..
使用傳統的 xml 方式裝配 hsf spring bean。
建立乙個 spring 配置檔案,如src/main/resources/hsf-consumer.xml
,表示要引用相關的hsf的服務。內容如下:
<?xml version="1.0" encoding="utf-8"
?>
xmlns=""
xmlns:xsi=""
xsi:schemalocation=" /spring-beans.xsd">
id="helloworldconsumer"
init-method="init">
name="inte***cename"
value="com.acme.demoservice"/>
name="version"
value="1.0.0.daily"/>
name="group"
value="hsf"/>
bean>
beans>
接下來就是在**中直接引入hsf服務的介面類,**如下:@importresource()
public
class
{}
嗯嗯嗯,會發布服務,消費服務就行,不會再看api@autowired
demoservice demoservice;
能想到登入失敗是這原因麼
接到同事 說有2個使用者不能登入,但是檢視後台資料確實有這個使用者,有效期也沒有問題。修改許可權或角色也看不出問題所在,其他使用者都能登入,就這2個使用者不能登入。猜猜看是什麼原因?的確是不好猜。因為使用者等著要用,所以還是老老實實的除錯程式吧。程式是誰寫的不重要,重要的是趕緊解決問題。注意到密碼少...
能想到登入失敗是這原因麼
接到同事 說有2個使用者不能登入,但是檢視後台資料確實有這個使用者,有效期也沒有問題。修改許可權或角色也看不出問題所在,其他使用者都能登入,就這2個使用者不能登入。猜猜看是什麼原因?的確是不好猜。因為使用者等著要用,所以還是老老實實的除錯程式吧。程式是誰寫的不重要,重要的是趕緊解決問題。注意到密碼少...
啥是Redis之整合springBoot
簡單解釋下 host 埠號password 密碼 預設為空,如有需要可以去redis.windows.conf 檔案中配置 requirepass 123456 這裡表示設定redis密碼為123456 database redis可用資料庫數,由於各業務場景需要分開儲存,預設從第0個開始,共16個...