spring中给bean默认命名的函数,如上图所示:

第一:为null或者为空,直接返回;

第二:如果长度大于1,且第一二个字符串都大写,直接返回;

第三:其他的,将第一个变成小写的。

代码验证:

 如图所示3个Bean的命名方式

@Component
public class APpleBean1 {
}

@Component
public class AppleBean2 {
}

@Component
public class APPLEBean3 {
}

 利用 actuator显示bean的name

http://localhost:8080/actuator/beans

 可以验证上面的结论


actuator的使用

	<dependencies>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-web</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-actuator</artifactId>
		</dependency>

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
			<scope>test</scope>
			<exclusions>
				<exclusion>
					<groupId>org.junit.vintage</groupId>
					<artifactId>junit-vintage-engine</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
	</dependencies>

	<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
			</plugin>
		</plugins>
	</build>

  

management:
  endpoints:
    web:
      exposure:
        include: "*"

  

下面是在网上随便找的一个
链接:https://www.jianshu.com/p/5230be715bd6

actuator为其他端点提供“发现页面”。要求Spring HATEOAS在classpath路径上。需要
auditevents陈列当前应用程序的审计事件信息。需要
autoconfig展示自动配置信息并且显示所有自动配置候选人以及他们“被不被”应用的原因。需要
beans显示应用程序中所有Spring bean的完整列表。需要
configprops显示所有配置信息。需要
dumpdump所有线程。需要
env陈列所有的环境变量。需要
flywayShows any Flyway database migrations that have been applied.需要
health显示应用程序运行状况信息不需要
info显示应用信息。不需要
loggers显示和修改应用程序中的loggers配置。需要
liquibase显示已经应用的任何Liquibase数据库迁移。需要
metrics显示当前应用程序的“指标”信息。需要
mappings显示所有@RequestMapping的url整理列表。需要
shutdown关闭应用(默认情况下不启用)。需要
trace显示跟踪信息(默认最后100个HTTP请求)。需要
12-17 13:17
查看更多