亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

java - spring annotation dynamic parameters
給我你的懷抱
給我你的懷抱 2017-05-27 17:40:04
0
3
945
@SuppressWarnings("serial")
@WebServlet(urlPatterns = "/druid/*",
        initParams = {
                @WebInitParam(name = "allow", value = "127.0.0.1"),// IP白名單 (沒(méi)有配置或者為空,則允許所有訪問(wèn))
                @WebInitParam(name = "deny", value = ""),// IP黑名單 (存在共同時(shí),deny優(yōu)先于allow)
                @WebInitParam(name = "loginUsername", value = "root"),// 用戶名
                @WebInitParam(name = "loginPassword", value = "password"),// 密碼
                @WebInitParam(name = "resetEnable", value = "false")// 禁用HTML頁(yè)面上的“Reset All”功能
        })
public class DruidStatViewServlet extends StatViewServlet {
    private static final long serialVersionUID = 1L;
}

Similar to the code above.

 @WebInitParam(name = "allow", value = "127.0.0.1"),// IP白名單 (沒(méi)有配置或者為空,則允許所有訪問(wèn))
 @WebInitParam(name = "deny", value = ""),// IP黑名單 (存在共同時(shí),deny優(yōu)先于allow)
 @WebInitParam(name = "loginUsername", value = "root"),// 用戶名
 @WebInitParam(name = "loginPassword", value = "password"),// 密碼
 @WebInitParam(name = "resetEnable", value = "false")// 禁用HTML頁(yè)面上的“Reset All”功能

How can these parameters be read and assigned from the configuration file?

給我你的懷抱
給我你的懷抱

reply all(3)
PHPzhong

Currently Spring Boot does not resolve the attribute values ??in @WebServlet in the Servlet 3.0 API. If the author needs it, you can define @Bean ServletRegistrationBean to get the value in Environment.

洪濤

Why not write it in the configuration file?

<init-param>
   <param-name>aaa</param-name>
   <param-value>
  bb
   </param-value>
  </init-param>

The annotation is to save the configuration file. You use the annotation and you have to return to the configuration file. I don’t understand it

伊謝爾倫

Choose one of the two annotations and configuration files. It depends on what you configure here is the druid monitoring servlet. The same content can be configured through web.xml. You can refer to the druid configuration document. Search Baidu, I won’t post the configuration file.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template