当前位置: 首页 > 知识库问答 >
问题:

关于 Spring 启动中多个模块的信息警告,它们是什么意思?

韩夕
2023-03-14

我最近将我的Spring启动版本提升到1.4.0。现在我看到下面的警告。我正在使用sping-mongob和sping-redis(严格用于缓存)。这是我应该关心的事情吗?

发现多个Spring数据模块,进入严格存储库配置模式!

Spring Data Redis-无法安全地识别存储库的存储分配

严格存储库配置模式的真正含义是什么?

    .   ____          _            __ _ _
/\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/  ___)| |_)| | | | | || (_| |  ) ) ) )
'  |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot ::        (v1.4.0.RELEASE)

2016-09-11 00:03:11.234  INFO 24766 --- [           main] testapp.Application                     : Starting Application on macbookhome with PID 24766 (/Users/me/Code/testapp/testapp-svc/build/classes/main started by me in /Users/me/Code/testapp/testapp-svc)
2016-09-11 00:03:11.238  INFO 24766 --- [           main] testapp.Application                     : The following profiles are active: default
2016-09-11 00:03:11.319  INFO 24766 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@7393222f: startup date [Sun Sep 11 00:03:11 EDT 2016]; root of context hierarchy
2016-09-11 00:03:14.092  INFO 24766 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
2016-09-11 00:03:14.275  INFO 24766 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
2016-09-11 00:03:14.346  INFO 24766 --- [           main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface testapp.repositories.topics.TopicRepository.
2016-09-11 00:03:14.349  INFO 24766 --- [           main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface testapp.repositories.entries.EntryRepository.
2016-09-11 00:03:14.350  INFO 24766 --- [           main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface testapp.repositories.AppSettingsRepository.
2016-09-11 00:03:14.351  INFO 24766 --- [           main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface testapp.repositories.UserRepository.
2016-09-11 00:03:14.353  INFO 24766 --- [           main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface testapp.repositories.BookmarkRepository.
2016-09-11 00:03:14.354  INFO 24766 --- [           main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface testapp.repositories.FlagRepository.
2016-09-11 00:03:14.356  INFO 24766 --- [           main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface testapp.repositories.FollowRepository.
2016-09-11 00:03:14.360  INFO 24766 --- [           main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface testapp.repositories.entries.UserEntryRepository.
2016-09-11 00:03:14.361  INFO 24766 --- [           main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface testapp.repositories.ShareRepository.
2016-09-11 00:03:14.899  INFO 24766 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'springAsyncConfiguration' of type [class testapp.configuration.SpringAsyncConfiguration$$EnhancerBySpringCGLIB$$2ae6dc36] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-09-11 00:03:14.923  INFO 24766 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 
2016-09-11 00:03:14.939  INFO 24766 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService  'taskExecutor'
2016-09-11 00:03:14.939  INFO 24766 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'taskExecutor' of type [class org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-09-11 00:03:15.026  INFO 24766 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cache.annotation.ProxyCachingConfiguration' of type [class org.springframework.cache.annotation.ProxyCachingConfiguration$$EnhancerBySpringCGLIB$$26a81448] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-09-11 00:03:15.658  INFO 24766 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2016-09-11 00:03:15.674  INFO 24766 --- [           main] o.apache.catalina.core.StandardService   : Starting service Tomcat
2016-09-11 00:03:15.675  INFO 24766 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.5.4
2016-09-11 00:03:15.801  INFO 24766 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2016-09-11 00:03:15.801  INFO 24766 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 4487 ms
2016-09-11 00:03:16.334  INFO 24766 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'metricFilter' to: [/*]
2016-09-11 00:03:16.335  INFO 24766 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter' to: [/*]
2016-09-11 00:03:16.335  INFO 24766 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2016-09-11 00:03:16.335  INFO 24766 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2016-09-11 00:03:16.336  INFO 24766 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'requestContextFilter' to: [/*]
2016-09-11 00:03:16.339  INFO 24766 --- [ost-startStop-1] .s.DelegatingFilterProxyRegistrationBean : Mapping filter: 'springSecurityFilterChain' to: [/*]
2016-09-11 00:03:16.339  INFO 24766 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'webRequestLoggingFilter' to: [/*]
2016-09-11 00:03:16.340  INFO 24766 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'applicationContextIdFilter' to: [/*]
2016-09-11 00:03:16.341  INFO 24766 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Mapping servlet: 'dispatcherServlet' to [/]
2016-09-11 00:03:17.075  INFO 24766 --- [           main] org.mongodb.driver.cluster               : Cluster created with settings {hosts=[ds041094-a0.mongolab.com:41094, ds041094-a1.mongolab.com:41094], mode=MULTIPLE, requiredClusterType=UNKNOWN, serverSelectionTimeout='30000 ms', maxWaitQueueSize=500}
2016-09-11 00:03:17.075  INFO 24766 --- [           main] org.mongodb.driver.cluster               : Adding discovered server ds041094-a0.mongolab.com:41094 to client view of cluster
2016-09-11 00:03:17.100  INFO 24766 --- [           main] org.mongodb.driver.cluster               : Adding discovered server ds041094-a1.mongolab.com:41094 to client view of cluster
2016-09-11 00:03:17.863  INFO 24766 --- [golab.com:41094] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:2, serverValue:976946}] to ds041094-a0.mongolab.com:41094
2016-09-11 00:03:17.888  INFO 24766 --- [golab.com:41094] org.mongodb.driver.cluster               : Monitor thread successfully connected to server with description ServerDescription{address=ds041094-a0.mongolab.com:41094, type=REPLICA_SET_PRIMARY, state=CONNECTED, ok=true, version=ServerVersion{versionList=[3, 0, 7]}, minWireVersion=0, maxWireVersion=3, maxDocumentSize=16777216, roundTripTimeNanos=24085956, setName='rs-ds041094', canonicalAddress=ds041094-a0.mongolab.com:41094, hosts=[ds041094-a0.mongolab.com:41094, ds041094-a1.mongolab.com:41094], passives=[], arbiters=[ds041094-ar0.mongolab.com:41094], primary='ds041094-a0.mongolab.com:41094', tagSet=TagSet{[]}, electionId=5736155bb89bc895bfdb9c2f, setVersion=3}
2016-09-11 00:03:17.890  INFO 24766 --- [golab.com:41094] org.mongodb.driver.cluster               : Discovered cluster type of REPLICA_SET
2016-09-11 00:03:17.890  INFO 24766 --- [golab.com:41094] org.mongodb.driver.cluster               : Adding discovered server ds041094-ar0.mongolab.com:41094 to client view of cluster
2016-09-11 00:03:17.891  INFO 24766 --- [golab.com:41094] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:1, serverValue:1178641}] to ds041094-a1.mongolab.com:41094
2016-09-11 00:03:17.892  INFO 24766 --- [golab.com:41094] org.mongodb.driver.cluster               : Setting max election id to 5736155bb89bc895bfdb9c2f from replica set primary ds041094-a0.mongolab.com:41094
2016-09-11 00:03:17.892  INFO 24766 --- [golab.com:41094] org.mongodb.driver.cluster               : Setting max set version to 3 from replica set primary ds041094-a0.mongolab.com:41094
2016-09-11 00:03:17.892  INFO 24766 --- [golab.com:41094] org.mongodb.driver.cluster               : Discovered replica set primary ds041094-a0.mongolab.com:41094
2016-09-11 00:03:17.943  INFO 24766 --- [golab.com:41094] org.mongodb.driver.cluster               : Monitor thread successfully connected to server with description ServerDescription{address=ds041094-a1.mongolab.com:41094, type=REPLICA_SET_SECONDARY, state=CONNECTED, ok=true, version=ServerVersion{versionList=[3, 0, 7]}, minWireVersion=0, maxWireVersion=3, maxDocumentSize=16777216, roundTripTimeNanos=51084368, setName='rs-ds041094', canonicalAddress=ds041094-a1.mongolab.com:41094, hosts=[ds041094-a0.mongolab.com:41094, ds041094-a1.mongolab.com:41094], passives=[], arbiters=[ds041094-ar0.mongolab.com:41094], primary='ds041094-a0.mongolab.com:41094', tagSet=TagSet{[]}, electionId=null, setVersion=3}
2016-09-11 00:03:18.108  INFO 24766 --- [golab.com:41094] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:3, serverValue:2200709}] to ds041094-ar0.mongolab.com:41094
2016-09-11 00:03:18.155  INFO 24766 --- [golab.com:41094] org.mongodb.driver.cluster               : Monitor thread successfully connected to server with description ServerDescription{address=ds041094-ar0.mongolab.com:41094, type=REPLICA_SET_ARBITER, state=CONNECTED, ok=true, version=ServerVersion{versionList=[3, 0, 7]}, minWireVersion=0, maxWireVersion=3, maxDocumentSize=16777216, roundTripTimeNanos=46937906, setName='rs-ds041094', canonicalAddress=ds041094-ar0.mongolab.com:41094, hosts=[ds041094-a0.mongolab.com:41094, ds041094-a1.mongolab.com:41094], passives=[], arbiters=[ds041094-ar0.mongolab.com:41094], primary='ds041094-a0.mongolab.com:41094', tagSet=TagSet{[]}, electionId=null, setVersion=3}
2016-09-11 00:03:18.357  INFO 24766 --- [           main] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:4, serverValue:976947}] to ds041094-a0.mongolab.com:41094
2016-09-11 00:03:20.185  INFO 24766 --- [           main] o.s.s.web.DefaultSecurityFilterChain     : Creating filter chain: OrRequestMatcher [requestMatchers=[Ant [pattern='/css/**'], Ant [pattern='/js/**'], Ant [pattern='/images/**'], Ant [pattern='/webjars/**'], Ant [pattern='/**/favicon.ico'], Ant [pattern='/error']]], []
2016-09-11 00:03:20.186  INFO 24766 --- [           main] o.s.s.web.DefaultSecurityFilterChain     : Creating filter chain: Ant [pattern='/health'], []
2016-09-11 00:03:20.186  INFO 24766 --- [           main] o.s.s.web.DefaultSecurityFilterChain     : Creating filter chain: Ant [pattern='/1.0/users/auth0/userInfo'], []
2016-09-11 00:03:20.186  INFO 24766 --- [           main] o.s.s.web.DefaultSecurityFilterChain     : Creating filter chain: Ant [pattern='/1.0/users/username/valid'], []
2016-09-11 00:03:20.314  INFO 24766 --- [           main] o.s.s.web.DefaultSecurityFilterChain     : Creating filter chain: org.springframework.security.web.util.matcher.AnyRequestMatcher@1, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@7cd3860, org.springframework.security.web.context.SecurityContextPersistenceFilter@3601549f, org.springframework.security.web.header.HeaderWriterFilter@4e789704, org.springframework.security.web.authentication.logout.LogoutFilter@18f4086e, org.springframework.security.web.authentication.www.BasicAuthenticationFilter@228958a, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@1b9c716f, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@22854f2b, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@44f23927, org.springframework.security.web.session.SessionManagementFilter@1e6bd367, org.springframework.security.web.access.ExceptionTranslationFilter@3205610d, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@5b2ff4df]
2016-09-11 00:03:20.323  INFO 24766 --- [           main] o.s.s.web.DefaultSecurityFilterChain     : Creating filter chain: org.springframework.boot.actuate.autoconfigure.ManagementWebSecurityAutoConfiguration$LazyEndpointPathRequestMatcher@253b1cbd, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@a859c5, org.springframework.security.web.context.SecurityContextPersistenceFilter@c335b9, org.springframework.security.web.header.HeaderWriterFilter@87fc0fc, org.springframework.security.web.authentication.logout.LogoutFilter@1e66bf2d, org.springframework.security.web.authentication.www.BasicAuthenticationFilter@75f2ff80, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@75c8d8e7, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@3c68e82, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@37083af6, org.springframework.security.web.session.SessionManagementFilter@671f545b, org.springframework.security.web.access.ExceptionTranslationFilter@74a03bd5, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@3831f4c2]
2016-09-11 00:03:20.642  INFO 24766 --- [           main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@7393222f: startup date [Sun Sep 11 00:03:11 EDT 2016]; root of context hierarchy
2016-09-11 00:03:20.746  INFO 24766 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/info],methods=[GET],produces=[application/json]}" onto public java.util.HashMap<java.lang.String, java.lang.String> testapp.controllers.AppInfoController.getAppInfo()
2016-09-11 00:03:20.789  INFO 24766 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/1.0/topics/user/{username}],methods=[GET]}" onto public org.springframework.data.domain.Page<testapp.models.Topic> testapp.controllers.api.v1.topic.TopicController.getTopicsByCategory(java.lang.String,java.lang.String,int,int,java.lang.String,java.lang.String,javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2016-09-11 00:03:20.791  INFO 24766 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2016-09-11 00:03:20.792  INFO 24766 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2016-09-11 00:03:20.938  INFO 24766 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2016-09-11 00:03:20.939  INFO 24766 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2016-09-11 00:03:20.988  INFO 24766 --- [           main] .m.m.a.ExceptionHandlerExceptionResolver : Detected @ExceptionHandler methods in testappSvcExceptionHandler
2016-09-11 00:03:21.046  INFO 24766 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2016-09-11 00:03:21.755  INFO 24766 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/health || /health.json],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.HealthMvcEndpoint.invoke(java.security.Principal)
2016-09-11 00:03:21.759  INFO 24766 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/metrics/{name:.*}],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.MetricsMvcEndpoint.value(java.lang.String)
2016-09-11 00:03:21.759  INFO 24766 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/metrics || /metrics.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2016-09-11 00:03:22.047  INFO 24766 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
2016-09-11 00:03:22.061  INFO 24766 --- [           main] o.s.c.support.DefaultLifecycleProcessor  : Starting beans in phase 0
2016-09-11 00:03:22.193  INFO 24766 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)
2016-09-11 00:03:22.234  INFO 24766 --- [           main] testapp.Application                     : Started Application in 11.601 seconds (JVM running for 12.241)
2016-09-11 00:06:17.685  INFO 24766 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring FrameworkServlet 'dispatcherServlet'
2016-09-11 00:06:17.685  INFO 24766 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : FrameworkServlet 'dispatcherServlet': initialization started
2016-09-11 00:06:17.719  INFO 24766 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : FrameworkServlet 'dispatcherServlet': initialization completed in 34 ms

共有3个答案

袁建木
2023-03-14

在我的例子中,我正确地使用了所有注释,但仍然出现了相同的错误。

我通过将JPA和Mongo存储库移动到不同的包并为每种技术配置基本包来解决问题。

@EnableJpaRepositories(basePackages = "com.example.repositories.jpa")
@EnableMongoRepositories(basePackages = "com.example.repositories.mongo")
class ConfigurationClass { ... }
富勇军
2023-03-14

文档中有一整节:

http://docs.spring.io/spring-data/jpa/docs/current/reference/html/#repositories.multiple-modules

基本上,如果您使用的是通用接口(例如CrudRepostory),那么Spring将不知道您是否希望该存储库在sping-mongob或sping-redis数据模块上得到支持。

萧永望
2023-03-14

如果您使用redis实现自己的持久层,那么您没有使用扩展CrudRepostory的接口。

这就是我的情况,我刚刚停用redis存储库搜索,下面的消息就从我的JPA存储库中消失了。

Spring Data Redis-无法安全地识别存储库候选接口的存储分配

要禁用在application.properties中设置为false的redis存储库:

spring.data.redis.repositories.type = none

在旧版本中:.repositories。enabled=false

这已经是一种解脱,因为对于许多JPA存储库来说,这很烦人。

 类似资料:
  • 这是一个相当简单的问题,但我不能就此罢休。我最近又开始使用C语言了(一开始并没有太多的经验),所以我可以更好地理解引擎盖下发生的事情。我当然知道,argc和argv在传递给main()时,分别表示参数计数和参数向量。我想弄清楚的是编译器如何将int argc解释为从命令行传递的参数数。如果我编写了一个简单的函数,试图模拟main(即int testfunc(int argc,char*argv[]

  • 使用 TiUP 部署 DM 集群的时候,会默认部署一套告警系统。 DM 的告警规则及其对应的处理方法可参考告警处理。 DM 的告警信息与监控指标均基于 Prometheus,告警规则与监控指标的对应关系可参考 DM 监控指标。

  • 问题内容: 如标题所述,有哪些不同的文档类型?它们的含义是什么?我注意到从切换到IE7时,布局看起来有些不同 至 还有其他的吗?影响或后果是什么? 谢谢! 问题答案: 一个 文档类型 或 文档类型声明 关联与文档 的文档类型定义 。 该 文档类型定义 是一个XML文档的标准。XML和XHTML文档都有许多DTD。XML本身并没有太多的架构或一组非常具体的规则,除了要求一切都必须格式正确。您可以将D

  • 本文向大家介绍python中 这两个参数是什么意思:*args,**kwargs?我们为什么使用它们?相关面试题,主要包含被问及python中 这两个参数是什么意思:*args,**kwargs?我们为什么使用它们?时的应答技巧和注意事项,需要的朋友参考一下 如果我们不确定要往一个函数中传入多少参数,或者我们希望以元祖或者列表的形式传参数时,我们可以使用*args。如果我们不知道要往函数中传递多少

  • 本文向大家介绍什么是JavaScript中的警告框?,包括了什么是JavaScript中的警告框?的使用技巧和注意事项,需要的朋友参考一下 警报对话框通常用于向用户发出警告消息。例如,如果一个输入字段要求输入一些文本,但用户未提供任何输入,则作为验证的一部分,您可以使用警报框来发出警告消息。 尽管如此,警报框仍可用于发送更友好的消息。警报框仅提供一个按钮“确定”以选择并继续。 示例 您可以尝试运行