當這個bean創建一個類爲MyBean
的bean id爲myBean
但是如果我從下面的接口創建服務bean,那麼bean ID是什麼?什麼是spring bean的bean ID實現了一個接口
@Service
public class ProfileServiceImpl implements ProfileService
當我嘗試爲@profileService
thymeleaf給下面的錯誤訪問豆。
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'profileService' is defined
所有這一次,我使用這個豆由autowiring
控制器。但目前我需要從thymeleaf
訪問這個。
我thymeleaf代碼段
<div th:unless="${@profileService.isMe(user)}">
謝謝你的回答。但與代碼設計有關,我在單獨的問題中發佈了我的問題。希望你也可以看看它。 http://stackoverflow.com/questions/29467886/implementing-crudrepository-in-spring-whats-the-best-design-i-should-follow – 2015-04-06 08:35:38