java springboot常用註解

2021-08-13 11:18:32 字數 679 閱讀 9134

表示事物唯讀

@transactional(readonly=true)

表示這是個service

@service("playerservice")

注入playerservice或者呼叫 dao的impl類

@autowired

api注釋

@apioperation(value = "login", notes = "登入")

表示方法名,請求方式

表示spring某個類的是否可以接收http請求

@restcontroller是@controller和@responsebody的結合體,直接返回return內容,無法返回jsp

@restcontroller

表示spring某個類的是否可以接收http請求

@controller 返回jsp

表示為介面實現類

表示開啟事物

@enabletransactionmanagement

表示為springboot啟動main

在springboot中用於註冊filter和servlet、listener

@servletcomponentscan

表示這是 servletcontextlistener監聽事件

@weblistener

java SpringBoot上傳附件

uploadpath c images spring.mvc.static path pattern spring.resources.static locations classpath meta inf resources classpath resources classpath static...

JAVA Spring boot相關技巧

1.註冊多例項。scope prototype 2.手工方式獲取註冊的例項。autowired private servletcontext servletcontext private t resolve classtype 3.多個同名類處理。註冊加別名,如 service abc 實現直接 a...

Java SpringBoot 實現多環境配置

springboot實現多環境配置 configuration public class datasourceconfig bean name secondarydatasource qualifier secondarydatasource primary configurationpropert...