目前分類:基礎介紹 (9)

瀏覽方式: 標題列表 簡短摘要

參考文件: https://howtodoinjava.com/spring-boot2/resttemplate/spring-restful-client-resttemplate-example/

    final String uri = "http://localhost:8080/springrestexample/employees/{id}";

JBLin 發表在 痞客邦 留言(0) 人氣()

在AOP Around 取得token後比對Redis內的token

    @Around("cut()") //環繞通知

JBLin 發表在 痞客邦 留言(0) 人氣()

1.pom.xml依賴

        <dependency>

JBLin 發表在 痞客邦 留言(0) 人氣()

@ConfigurationProperties(prefix = "spring.redis")//從application.properties取得spring.redis開頭的資料

class註解
@Configuration //配置類

注入註解
@Autowired 根據物件屬性自動注入

JBLin 發表在 痞客邦 留言(0) 人氣()

@Transactional 可用在interface 也可用在實作層(建議)

JBLin 發表在 痞客邦 留言(0) 人氣()

@Component 最普通的組件,可以被注入到spring容器進行管理
@Repository 作用於持久層(資料庫讀取、DAO)
@Service 作用於業務邏輯層
@Controller 作用於表現層(spring-mvc的註解)

 

資料庫-<>@Repository<>@Service<->@Controller

JBLin 發表在 痞客邦 留言(0) 人氣()

@scope

1.  Singleton :默認型態,全容器只使用一個實例

JBLin 發表在 痞客邦 留言(0) 人氣()

1.下載spring boot project tool

Help -> EclipseMarketplace

JBLin 發表在 痞客邦 留言(0) 人氣()

@Controller
public class TestController {

JBLin 發表在 痞客邦 留言(0) 人氣()