本文整理汇总了Java中org.springframework.boot.actuate.endpoint.Endpoint类的典型用法代码示例。如果您正苦于以下问题:Java Endpoint类的具体用法?Java Endpoint怎么用?Java Endpoint使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Endpoint类属于org.springframework.boot.actuate.endpoint包,在下文中一共展示了Endpoint类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: registerEndpoint
import org.springframework.boot.actuate.endpoint.Endpoint; //导入依赖的package包/类
protected void registerEndpoint(String beanName, Endpoint<?> endpoint) {
@SuppressWarnings("rawtypes")
Class<? extends Endpoint> type = endpoint.getClass();
if (AnnotationUtils.findAnnotation(type, ManagedResource.class) != null) {
// Already managed
return;
}
if (type.isMemberClass()
&& AnnotationUtils.findAnnotation(type.getEnclosingClass(),
ManagedResource.class) != null) {
// Nested class with @ManagedResource in parent
return;
}
try {
registerBeanNameOrInstance(getEndpointMBean(beanName, endpoint), beanName);
}
catch (MBeanExportException ex) {
logger.error("Could not register MBean for endpoint [" + beanName + "]", ex);
}
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:21,代码来源:EndpointMBeanExporter.java
示例2: afterPropertiesSet
import org.springframework.boot.actuate.endpoint.Endpoint; //导入依赖的package包/类
@Override
public void afterPropertiesSet() throws Exception {
Collection<MvcEndpoint> existing = BeanFactoryUtils
.beansOfTypeIncludingAncestors(this.applicationContext, MvcEndpoint.class)
.values();
this.endpoints.addAll(existing);
this.customTypes = findEndpointClasses(existing);
@SuppressWarnings("rawtypes")
Collection<Endpoint> delegates = BeanFactoryUtils
.beansOfTypeIncludingAncestors(this.applicationContext, Endpoint.class)
.values();
for (Endpoint<?> endpoint : delegates) {
if (isGenericEndpoint(endpoint.getClass()) && endpoint.isEnabled()) {
EndpointMvcAdapter adapter = new EndpointMvcAdapter(endpoint);
String path = determinePath(endpoint,
this.applicationContext.getEnvironment());
if (path != null) {
adapter.setPath(path);
}
this.endpoints.add(adapter);
}
}
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:24,代码来源:MvcEndpoints.java
示例3: pingEndpoint
import org.springframework.boot.actuate.endpoint.Endpoint; //导入依赖的package包/类
@Bean
public static Endpoint<String> pingEndpoint() {
return new Endpoint<String>() {
@Override
public String getId() {
return "ping";
}
@Override
public boolean isEnabled() {
return true;
}
@Override
public boolean isSensitive() {
return false;
}
@Override
public String invoke() {
return "OK";
}
};
}
示例4: afterPropertiesSet
import org.springframework.boot.actuate.endpoint.Endpoint; //导入依赖的package包/类
@Override
public void afterPropertiesSet() throws Exception {
Collection<MvcEndpoint> existing = BeanFactoryUtils
.beansOfTypeIncludingAncestors(this.applicationContext, MvcEndpoint.class)
.values();
this.endpoints.addAll(existing);
this.customTypes = findEndpointClasses(existing);
@SuppressWarnings("rawtypes")
Collection<Endpoint> delegates = BeanFactoryUtils
.beansOfTypeIncludingAncestors(this.applicationContext, Endpoint.class)
.values();
for (Endpoint<?> endpoint : delegates) {
if (isGenericEndpoint(endpoint.getClass()) && endpoint.isEnabled()) {
EndpointMvcAdapter adapter = new EndpointMvcAdapter(endpoint);
String path = this.applicationContext.getEnvironment()
.getProperty("endpoints." + endpoint.getId() + ".path");
if (path != null) {
adapter.setPath(path);
}
this.endpoints.add(adapter);
}
}
}
示例5: locateAndRegisterEndpoints
import org.springframework.boot.actuate.endpoint.Endpoint; //导入依赖的package包/类
@SuppressWarnings({ "rawtypes" })
protected void locateAndRegisterEndpoints() {
Map<String, Endpoint> endpoints = this.beanFactory.getBeansOfType(Endpoint.class);
for (Map.Entry<String, Endpoint> endpointEntry : endpoints.entrySet()) {
if (!this.registeredEndpoints.contains(endpointEntry.getValue())
&& endpointEntry.getValue().isEnabled()) {
registerEndpoint(endpointEntry.getKey(), endpointEntry.getValue());
this.registeredEndpoints.add(endpointEntry.getValue());
}
}
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:12,代码来源:EndpointMBeanExporter.java
示例6: parentContextContainsSameBean
import org.springframework.boot.actuate.endpoint.Endpoint; //导入依赖的package包/类
private boolean parentContextContainsSameBean(ApplicationContext applicationContext,
String beanKey) {
if (applicationContext.getParent() != null) {
try {
this.applicationContext.getParent().getBean(beanKey, Endpoint.class);
return true;
}
catch (BeansException ex) {
return parentContextContainsSameBean(applicationContext.getParent(),
beanKey);
}
}
return false;
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:15,代码来源:EndpointMBeanExporter.java
示例7: EndpointMBean
import org.springframework.boot.actuate.endpoint.Endpoint; //导入依赖的package包/类
/**
* Create a new {@link EndpointMBean} instance.
* @param beanName the bean name
* @param endpoint the endpoint to wrap
* @param objectMapper the {@link ObjectMapper} used to convert the payload
*/
public EndpointMBean(String beanName, Endpoint<?> endpoint,
ObjectMapper objectMapper) {
Assert.notNull(beanName, "BeanName must not be null");
Assert.notNull(endpoint, "Endpoint must not be null");
Assert.notNull(objectMapper, "ObjectMapper must not be null");
this.endpoint = endpoint;
this.mapper = objectMapper;
this.listObject = objectMapper.getTypeFactory()
.constructParametricType(List.class, Object.class);
this.mapStringObject = objectMapper.getTypeFactory()
.constructParametricType(Map.class, String.class, Object.class);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:19,代码来源:EndpointMBean.java
示例8: determinePath
import org.springframework.boot.actuate.endpoint.Endpoint; //导入依赖的package包/类
private String determinePath(Endpoint<?> endpoint, Environment environment) {
ConfigurationProperties configurationProperties = AnnotationUtils
.findAnnotation(endpoint.getClass(), ConfigurationProperties.class);
if (configurationProperties != null) {
return environment.getProperty(configurationProperties.prefix() + ".path");
}
return null;
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:9,代码来源:MvcEndpoints.java
示例9: determinePath
import org.springframework.boot.actuate.endpoint.Endpoint; //导入依赖的package包/类
private String determinePath(Endpoint<?> endpoint, Environment environment) {
ConfigurationProperties configurationProperties = AnnotationUtils
.findAnnotation(endpoint.getClass(), ConfigurationProperties.class);
if (configurationProperties != null) {
String prefix = StringUtils.hasText(configurationProperties.prefix())
? configurationProperties.prefix() : configurationProperties.value();
return environment.getProperty(prefix + ".path");
}
return null;
}
示例10: EndpointMBean
import org.springframework.boot.actuate.endpoint.Endpoint; //导入依赖的package包/类
/**
* Create a new {@link EndpointMBean} instance.
* @param beanName the bean name
* @param endpoint the endpoint to wrap
* @param objectMapper the {@link ObjectMapper} used to convert the payload
*/
public EndpointMBean(String beanName, Endpoint<?> endpoint,
ObjectMapper objectMapper) {
Assert.notNull(beanName, "BeanName must not be null");
Assert.notNull(endpoint, "Endpoint must not be null");
Assert.notNull(objectMapper, "ObjectMapper must not be null");
this.endpoint = endpoint;
this.mapper = objectMapper;
}
示例11: getEndpointType
import org.springframework.boot.actuate.endpoint.Endpoint; //导入依赖的package包/类
@Override
public Class<? extends Endpoint> getEndpointType() {
return null;
}
示例12: getEndpointMBean
import org.springframework.boot.actuate.endpoint.Endpoint; //导入依赖的package包/类
protected EndpointMBean getEndpointMBean(String beanName, Endpoint<?> endpoint) {
if (endpoint instanceof ShutdownEndpoint) {
return new ShutdownEndpointMBean(beanName, endpoint, this.objectMapper);
}
return new DataEndpointMBean(beanName, endpoint, this.objectMapper);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:7,代码来源:EndpointMBeanExporter.java
示例13: getEndpoint
import org.springframework.boot.actuate.endpoint.Endpoint; //导入依赖的package包/类
public Endpoint<?> getEndpoint() {
return this.endpoint;
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:4,代码来源:EndpointMBean.java
示例14: getEndpointType
import org.springframework.boot.actuate.endpoint.Endpoint; //导入依赖的package包/类
@Override
@SuppressWarnings("rawtypes")
public Class<? extends Endpoint> getEndpointType() {
return null;
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:6,代码来源:AbstractMvcEndpoint.java
示例15: getEndpointType
import org.springframework.boot.actuate.endpoint.Endpoint; //导入依赖的package包/类
@Override
@SuppressWarnings("rawtypes")
public Class<? extends Endpoint> getEndpointType() {
return this.delegate.getClass();
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:6,代码来源:AbstractEndpointMvcAdapter.java