- 浏览: 764801 次
- 性别:
- 来自: 南京
文章分类
- 全部博客 (663)
- Eclipse&MyEclipse (40)
- PHP (3)
- Java (72)
- CSS (3)
- MySQL (35)
- Oracle (68)
- Red Hat Linux (23)
- Tomcat (26)
- Oracle10gAS (1)
- Spring (28)
- MyBatis&iBatis (13)
- JS (47)
- JQuery (23)
- Editplus (2)
- 其他 (4)
- Html (15)
- SQL (5)
- Ant (2)
- Hadoop (2)
- Servlet (9)
- Windows (11)
- Flex (1)
- CentOS Linux (7)
- Microsoft SQL Server (2)
- DB2 (3)
- Mysql char 与 varchar 区别 (0)
- excel (5)
- jsp (8)
- FreeMarker (1)
- EasyUI (5)
- WebShpere MQ (1)
- Maven2 (6)
- 浏览器缓存 (2)
- visio (1)
- XML (2)
- 物联网 (1)
- Maven (3)
- JSTL (2)
- HTTP (1)
- Fourinone (1)
- IP知识 (1)
- MyBatis (1)
- 项目管理 (2)
- office2003+2007 (1)
- DOS (1)
- JProfiler (1)
- Thinpad T440p (1)
- ActiveMQ (10)
- MongoDB (5)
- Vert.x3 (1)
- Ngnix (3)
- Spark (2)
- BigData (1)
- 性能概念公式 (1)
- RocketMQ (3)
- IT名词术语 (1)
- Java编程工具 (1)
- RabbitMQ (2)
- MetaMQ (1)
- 架构 (6)
- KafkaMQ (7)
- Redis (4)
- OAuth (1)
- Gradle (1)
- CentOS (5)
- Microsoft_Toolkit (1)
- git (5)
- IntelliJ Idea (4)
- Nginx (3)
- docker (12)
- VMware (2)
- 算法 (1)
- JDBCPool (1)
- spring-cloud (7)
- netbean (1)
- 微信小程序 (2)
- CURL (2)
- Java生成二维码 (1)
- 区块链 (2)
- 机器学习 (1)
- SpringBoot (3)
- Android (9)
- 微服务架构 (1)
- Kubernetes (2)
- OpenProject (0)
- 测试 (1)
- https (1)
- 开源许可证 (1)
- ServiceMesh (2)
- NET (0)
- .NET (1)
- TEST (1)
- iOS (2)
- thymeleaf (4)
- lombok (1)
- 浏览器设置 (1)
- 富文本编辑器 (1)
- 搜索引擎 (1)
- IT常识 (1)
- UML (0)
- Axure (1)
- appstore无法联网 (0)
- apk无法安装 (1)
- SQLServer (2)
- 卸载弹窗软件 (1)
- jenkins (1)
- TortoiseGit (1)
- eureka (1)
- ajax (1)
- spyder (0)
最新评论
0,
There is special support for retrieving multiple class path resources with the same name, via the "classpath*" prefix. For example, "classpath*:/beans.xml" will find all beans.xml files in the class path, be it in "classes" directories or in JAR files. This is particularly useful for auto-detecting config files.
1,
Hmm..After reading PathMatchingResourcePatternResolver, it looks like classpath* prefix should work with wildcards in mutliple JARs. My test showed it worked for contexts in WEB/classes, but not with a mix in WEB-INF/classes, and some in JARs in WEB-INF/lib. Maybe a bug?
Just updating this post...
OK - just to clarify after feedback from Juergen. classpath*: and wildcards do work, but not from the root directory within JARs. So for application contexts in the classpath at:
/com/company/applicationContext.xml
/com/company/applicationContext-ds.xml
If they're in WEB-INF/classes the following will work:
classpath*:**/applicationContext*.xml
If they're in a JAR in WEB-INF/lib the following will work:
classpath*:/com/**/applicationContext*.xml
2,
When you use 'classpath:' for an Ant style wildcard search, Spring uses a single classpath directory for the search. The documentation is vague, but it seems the directory returned will be the first one provided by ClassLoader.getResources(""). In our case, it returned the '/target/test-classes' directory that contains applicationTest.xml and our test classes, instead of '/target/classes' which contains application.xml and all the *.hbm.xml files.
Using the 'classpath*:' prefix fixes the problem. It indicates that the resource loader should look in all directories on the classpath, so making this change solved our problem. Apparently Spring maintains both prefixes because limitations in the Classloader (at the specification level) make it difficult to search for resources in the classpath root when performing wildcard searches across all classpath directories. This suggest it might be good practice to always create a directory to contain resources you might otherwise want to put in the classpath root and always use the 'claspath*:' prefix.
There is special support for retrieving multiple class path resources with the same name, via the "classpath*" prefix. For example, "classpath*:/beans.xml" will find all beans.xml files in the class path, be it in "classes" directories or in JAR files. This is particularly useful for auto-detecting config files.
1,
Hmm..After reading PathMatchingResourcePatternResolver, it looks like classpath* prefix should work with wildcards in mutliple JARs. My test showed it worked for contexts in WEB/classes, but not with a mix in WEB-INF/classes, and some in JARs in WEB-INF/lib. Maybe a bug?
Just updating this post...
OK - just to clarify after feedback from Juergen. classpath*: and wildcards do work, but not from the root directory within JARs. So for application contexts in the classpath at:
/com/company/applicationContext.xml
/com/company/applicationContext-ds.xml
If they're in WEB-INF/classes the following will work:
classpath*:**/applicationContext*.xml
If they're in a JAR in WEB-INF/lib the following will work:
classpath*:/com/**/applicationContext*.xml
2,
When you use 'classpath:' for an Ant style wildcard search, Spring uses a single classpath directory for the search. The documentation is vague, but it seems the directory returned will be the first one provided by ClassLoader.getResources(""). In our case, it returned the '/target/test-classes' directory that contains applicationTest.xml and our test classes, instead of '/target/classes' which contains application.xml and all the *.hbm.xml files.
Using the 'classpath*:' prefix fixes the problem. It indicates that the resource loader should look in all directories on the classpath, so making this change solved our problem. Apparently Spring maintains both prefixes because limitations in the Classloader (at the specification level) make it difficult to search for resources in the classpath root when performing wildcard searches across all classpath directories. This suggest it might be good practice to always create a directory to contain resources you might otherwise want to put in the classpath root and always use the 'claspath*:' prefix.
发表评论
-
Spring Framework 5.0 入门篇(转)
2019-04-25 10:00 01.为什么学习Spring? 随着对Java EE ... -
springboot2.0跨域配置(转)
2018-07-17 13:24 693springboot2.0跨域配置: 一、代码 ... -
springboot2.0跨域配置
2018-07-06 14:44 944springboot2.0跨域配置: 一、代码 Java ... -
spring boot + mybatis 完整配置过程+mybatis 体会(转)
2016-09-23 17:07 3990在团队里面现在大多 ... -
使用Spring Cloud和Docker构建微服务(转)
2016-08-17 10:38 1130【编者的话】这是系 ... -
Spring定时任务的几种实现(转)
2015-10-30 11:55 595Spring定时任务的几种实现 近日项目开发中需要执行一 ... -
Spring下载方式(转)
2015-10-29 16:23 634Spring官网改版后,很多项目的完整zip包下载链接已经 ... -
quartz在集群环境下的最终解决方案 (转)
2014-11-21 15:37 749原创:http://blog.csdn.net/l ... -
javax.servlet.ServletException: Could not resolve view with name 'ok' in (转)
2014-05-31 23:10 2959最近使用spring mvc开发项目,遇到一个问题: ... -
Spring MVC 同一URL 触发了 Controller 中的方法两次
2014-04-16 15:06 1373Spring MVC 同一URL 触发了 Controlle ... -
主题:Spring Web MVC中的页面缓存支持 ——跟我学SpringMVC系列(转)
2014-04-15 16:59 828原作者 网址 http://www.iteye.com/t ... -
springMVC No mapping found for HTTP request with URI(转)
2013-10-25 17:32 934No mapping found for HTTP requ ... -
spring3使用@ResponseBody 输出乱码,加入此配置(转)
2013-10-23 15:32 806spring3使用@ResponseBody 输出乱码,加入 ... -
{@org.springframework.beans.factory.annotation.Autowired(required=true)}
2013-10-08 12:01 1718Caused by: org.springframework ... -
Spring 如何引用 jar中的XML(转)
2013-09-11 15:13 1234在基于Spring构建的项目中,我们都知道核心的Contex ... -
sprng mvc3 日期自动绑定(转)
2013-06-13 15:50 942原文 http://blog.csdn.net/whum ... -
在使用spring3 mvc中 int 自动绑定(转)
2013-06-13 15:48 1074import java.beans.PropertyEdit ... -
严重: Servlet.service() for servlet
2013-05-11 14:43 3648Spring MVC 严重: Servlet.servi ... -
Spring MVC 3.1 @ResponseBody 返回字符串乱码(转)
2012-08-30 12:04 0原作者:http://fableking.iteye.com/ ... -
Spring 3 MVC No mapping found for HTTP request with URI (转)
2012-08-19 23:36 1679原作者:http://chokee.iteye.com/blo ...
相关推荐
- **在不使用parent POM的情况下玩转Spring Boot**:介绍没有parent POM时如何配置项目。 - **改变Java版本**:说明如何更改项目使用的Java版本。 - **使用Spring Boot Maven插件**:指导如何使用Spring Boot的...
#### 二、Spring Boot 文档说明 - **文档内容**:本文档主要介绍了如何使用Spring Boot快速搭建和部署应用程序,并提供了详细的指导和实例。 - **获取帮助**:提供官方文档、论坛、社区等途径获取技术支持。 - **第...
- **Classpath上有多个Binders**:说明如何处理类路径上存在多个Binder的情况。 - **连接到多个系统**:介绍如何配置Binder以连接到多个消息系统。 - **Binder配置属性**:讲解如何配置Binder的各种属性。 - **...
- **在不使用parent POM的情况下玩转Spring Boot**:介绍了一种无需parent POM也能有效管理项目的方法。 - **改变Java版本**:指导如何更改项目的编译目标版本。 - **使用Spring Boot Maven插件**:介绍如何利用...
- **使用Spring Boot Maven插件**: 说明了Spring Boot Maven插件的用法。 - **Gradle**: 简述了Gradle下Spring Boot的配置。 - **Ant**: 简单提及了使用Ant构建Spring Boot应用的可能性。 - **Starter POMs**: 介绍...
### 整合技术框架说明 本文档主要介绍了如何将Struts2、Spring3.0、JUnit4.7和Maven2.2.1这几种技术框架整合在一起,以构建一个功能完善的Java EE项目。该文档的目标是帮助开发人员理解如何在实际项目中应用这些...
- **针对 Java 开发者的安装说明** - **Maven 安装**: 使用 Maven 作为构建工具,可以通过添加依赖到项目的 POM 文件来安装 Spring Boot。 - **Gradle 安装**: 类似于 Maven,通过 Gradle 构建脚本中的依赖管理来...
- **Spring Cloud Config客户端**:说明了如何配置客户端以监听来自Spring Cloud Bus的通知,并自动刷新其配置。 #### Spring Cloud Netflix - **服务发现:Eureka客户端**:介绍了如何集成Netflix Eureka客户端...
- 说明了如何运行已打包的Spring Boot应用。 - **使用Maven插件运行** - 介绍了如何利用Maven插件来启动Spring Boot应用。 - **使用Gradle插件运行** - 提供了使用Gradle插件启动Spring Boot应用的方法。 - **...
Maven安装**:详细说明了如何通过Maven搭建Spring Boot项目。 - **10.1.2. Gradle安装**:提供了通过Gradle构建工具创建Spring Boot项目的步骤。 - **10.2. Spring Boot CLI安装**: - **10.2.1. 手动安装**:...
通过运行`test1`类,如果测试成功,说明Spring已经成功整合了MyBatis,可以正常执行数据库查询和其他操作。 总的来说,Spring与MyBatis的整合使得我们可以在享受Spring的强大管理能力的同时,充分利用MyBatis的灵活...
【Springmybatis工程说明】 Springmybatis工程是一个整合了Spring框架和Mybatis持久层框架的项目,用于构建基于Java的企业级应用。这个工程遵循了一种常见的MVC(Model-View-Controller)架构模式,其中Spring负责...
- **在Spring环境中使用YAML暴露属性**:说明如何在Spring环境中解析YAML配置。 - **Multi-profile YAML文档**:讲解如何使用多环境的YAML配置。 - **YAML缺点**:讨论YAML相比Properties的一些局限性。 - **...
- **Spring MVC自动配置**:说明了Spring Boot是如何自动配置Spring MVC的。 - **HttpMessageConverters**:解释了如何配置HTTP消息转换器。 - **MessageCodesResolver**:介绍了如何处理消息编码解析的过程。 ...
这种机制允许开发人员将组件之间的依赖关系从代码中分离出来,转而由容器进行管理。这种方式极大地提高了软件系统的可测试性和可维护性。 #### 模块 Spring Framework被设计为模块化的,每个模块都可以单独使用,...
- **在Spring环境中使用YAML暴露属性**:说明如何在Spring环境中读取YAML配置。 - **Multi-profile YAML文档**:支持在同一YAML文件中定义多个profile。 - **YAML缺点**:指出使用YAML可能遇到的问题。 - **类型...
- 添加类路径依赖(Adding classpath dependencies):说明如何添加项目所需的各种依赖库。 - 编写代码(Writing the code): - `@RestController` 和 `@RequestMapping` 注解:解释这两个注解的作用和用法。 -...
- **Classpath 扫描**:介绍了如何扫描类路径以发现 Entity 类和 JPA 映射文件。 - **CDI 集成**:解释了如何将 Spring Data JPA 与 CDI(Contexts and Dependency Injection)集成起来。 7. **附录**:提供了名称...
- **Java Developer 安装说明**:对于使用Maven的开发者来说,可以通过`<dependency>`标签在pom.xml文件中添加Spring Boot Starter依赖;而使用Gradle的开发者则可以在build.gradle文件中添加依赖。此外,还可以...