3
回答
spring maven pom配置 artifactId 能否支持通配符?
利用AWS快速构建适用于生产的无服务器应用程序,免费试用12个月>>>   

在pom中配置spring依赖的时候需要写多个dependecy,

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.0.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>4.0.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>4.0.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>4.0.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>4.0.3.RELEASE</version>
</dependency>
哪种方式可以减少这种配置?

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-*</artifactId>
<version>4.0.3.RELEASE</version>
</dependency>

举报
debugable
发帖于1年前 3回/381阅
共有3个答案 最后回答: 1年前

没办法,确实需要配置多个,不过spring自己会互相依赖,所以只需要配置几个就够了,

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-jdbc</artifactId>
    <version>${version.spring}</version>
</dependency>
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-webmvc</artifactId>
    <version>${version.spring}</version>
</dependency>
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-context-support</artifactId>
    <version>${version.spring}</version>
</dependency>



引用来自“阿信sxq”的评论

没办法,确实需要配置多个,不过spring自己会互相依赖,所以只需要配置几个就够了,

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-jdbc</artifactId>
    <version>${version.spring}</version>
</dependency>
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-webmvc</artifactId>
    <version>${version.spring}</version>
</dependency>
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-context-support</artifactId>
    <version>${version.spring}</version>
</dependency>



恩呢,突然想到这个问题,哈哈
顶部