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

带有Spring Social框架和Jersey的Maven项目

姬心思
2023-03-14

我想实现一个Maven项目,它使用与Jersey集成的Spring social框架。但是它有一些依赖问题。

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.social.samples</groupId>
<artifactId>world-rank</artifactId>
<name>World Rank</name>
<packaging>war</packaging>
<version>1.0.0</version>
<properties>
    <java-version>1.6</java-version>
    <org.springframework.social-version>1.1.0.BUILD-SNAPSHOT</org.springframework.social-version>
    <org.springframework.social.facebook-version>1.1.0.BUILD-SNAPSHOT</org.springframework.social.facebook-version>
    <org.springframework.social.twitter-version>1.1.0.BUILD-SNAPSHOT</org.springframework.social.twitter-version>
    <org.springframework-version>3.1.1.RELEASE</org.springframework-version>
    <org.springframework.security-version>3.1.0.RELEASE</org.springframework.security-version>
    <org.slf4j-version>1.6.1</org.slf4j-version>
</properties>
<dependencies>
    <!-- Jersey -->

    <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-server</artifactId>
        <version>1.8</version>
    </dependency>

    <!-- Spring -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>${org.springframework-version}</version>
        <exclusions>
            <!-- Exclude Commons Logging in favor of SLF4j -->
            <exclusion>
                <groupId>commons-logging</groupId>
                <artifactId>commons-logging</artifactId>
             </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>${org.springframework-version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-jdbc</artifactId>
        <version>${org.springframework-version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-tx</artifactId>
        <version>${org.springframework-version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-web</artifactId>
        <version>${org.springframework.security-version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-taglibs</artifactId>
        <version>${org.springframework.security-version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-config</artifactId>
        <version>${org.springframework.security-version}</version>
    </dependency>       
    <dependency>
        <groupId>org.springframework.social</groupId>
        <artifactId>spring-social-core</artifactId>
        <version>${org.springframework.social-version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.social</groupId>
        <artifactId>spring-social-facebook</artifactId>
        <version>${org.springframework.social.facebook-version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.social</groupId>
        <artifactId>spring-social-twitter</artifactId>
        <version>${org.springframework.social.twitter-version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.social</groupId>
        <artifactId>spring-social-web</artifactId>
        <version>${org.springframework.social-version}</version>
    </dependency>

    <!-- Jersey + Spring -->

    <dependency>
        <groupId>com.sun.jersey.contribs</groupId>
        <artifactId>jersey-spring</artifactId>
        <version>1.8</version>
        <exclusions>
            <exclusion>
                <groupId>org.springframework</groupId>
                <artifactId>spring</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.springframework</groupId>
                <artifactId>spring-core</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.springframework</groupId>
                <artifactId>spring-web</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.springframework</groupId>
                <artifactId>spring-beans</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.springframework</groupId>
                <artifactId>spring-context</artifactId>
            </exclusion>
        </exclusions>
    </dependency>


    <!-- Apache Http Client -->
    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpclient</artifactId>
        <version>4.1.2</version>
        <exclusions>
            <!-- Exclude Commons Logging in favor of SLF4j -->
            <exclusion>
                <groupId>commons-logging</groupId>
                <artifactId>commons-logging</artifactId>
            </exclusion>
        </exclusions>           
    </dependency>

    <!-- JSR 303 with Hibernate Validator -->
    <dependency>
        <groupId>javax.validation</groupId>
        <artifactId>validation-api</artifactId>
        <version>1.0.0.GA</version>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-validator</artifactId>
        <version>4.1.0.Final</version>
    </dependency>

    <!-- Logging -->
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>${org.slf4j-version}</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>jcl-over-slf4j</artifactId>
        <version>${org.slf4j-version}</version>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>${org.slf4j-version}</version>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.16</version>
        <scope>runtime</scope>
    </dependency>

    <dependency>
        <groupId>com.h2database</groupId>
        <artifactId>h2</artifactId>
        <version>1.3.159</version>
    </dependency>

    <!-- CGLIB, only required and used for @Configuration usage -->
    <dependency>
        <groupId>cglib</groupId>
        <artifactId>cglib-nodep</artifactId>
        <version>2.2</version>
    </dependency>

    <!-- Apache Tiles -->
    <dependency>
        <groupId>org.apache.tiles</groupId>
        <artifactId>tiles-jsp</artifactId>
        <version>2.2.2</version>
    </dependency>
    <dependency>
        <groupId>org.apache.tiles</groupId>
        <artifactId>tiles-el</artifactId>
        <version>2.2.2</version>
    </dependency>

    <!-- @Inject -->
    <dependency>
        <groupId>javax.inject</groupId>
        <artifactId>javax.inject</artifactId>
        <version>1</version>
    </dependency>

    <!-- Servlet -->
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
        <version>2.5</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.servlet.jsp</groupId>
        <artifactId>jsp-api</artifactId>
        <version>2.1</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.servlet.jsp.jstl</groupId>
        <artifactId>jstl-api</artifactId>
        <version>1.2</version>
    </dependency>
    <dependency>
        <groupId>org.glassfish.web</groupId>
        <artifactId>jstl-impl</artifactId>
        <version>1.2</version>
    </dependency>
</dependencies>
<repositories>
    <repository>
        <id>org.springframework.maven.release</id>
        <name>Spring Maven Release Repository</name>
        <url>http://maven.springframework.org/release</url>
        <releases><enabled>true</enabled></releases>
        <snapshots><enabled>false</enabled></snapshots>
    </repository>
    <!-- For testing against latest Spring snapshots -->
    <repository>
        <id>org.springframework.maven.snapshot</id>
        <name>Spring Maven Snapshot Repository</name>
        <url>http://maven.springframework.org/snapshot</url>
        <releases><enabled>false</enabled></releases>
        <snapshots><enabled>true</enabled></snapshots>
    </repository>
    <!-- For developing against latest Spring milestones -->
    <repository>
        <id>org.springframework.maven.milestone</id>
        <name>Spring Maven Milestone Repository</name>
        <url>http://maven.springframework.org/milestone</url>
        <snapshots><enabled>false</enabled></snapshots>
    </repository>
</repositories>
<build>
    <resources>
        <resource>
            <directory>src/main/java</directory>
        </resource>
    </resources>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <source>${java-version}</source>
                <target>${java-version}</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.1.1</version>
            <configuration>
                <warName>spring-social-popup</warName>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>tomcat-maven-plugin</artifactId>
            <version>1.1</version>
        </plugin>
    </plugins>
</build>

共有1个答案

羊舌自强
2023-03-14

我也遇到了同样的问题,在我的案例中,添加AOP依赖有助于解决问题。我想Spring Security的某些部分需要它。

尝试添加:

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-aop</artifactId>
    <version>3.1.0.RELEASE</version>
</dependency>
 类似资料:
  • 我们面临的最大问题是,我们无法找出如何构造项目C,以使其在项目A和B中都能正常工作。在项目A中,我们希望maven能像往常一样工作,并根据需要降低依赖项。但我们也希望在项目B(也许结合Nexus+Tycho??)中实现该功能。 我们应该如何解决这个问题。我还没有找到一个好的解决办法如何做这件事。我已经在maven中尝试了apache felix捆绑插件,但不能让它像我想要的那样工作。这是正确的解决

  • 我有一个带有自定义项的列表视图,比如: 灰色正方形是ImageView。填充ListView的数据来自光标形式的数据库。但图像并不直接存储在数据库中,而是在SDCard中,数据库仅保存对它们的String引用。 一开始,我将Image解码为来自覆盖CursorAdapter的bindView()回调方法的位图: 但是ListView的滚动非常缓慢。因此,我阅读了Executor框架并实现了它,用以

  • 我想通过Remote tecommand操作打开一个对话框,并从页面后备bean中的中获取值。远程命令在页面加载时正确触发bb中的actionListener 使用此show Dialog方法也可以正确显示对话框: 在另一个Bean中: 问题是,我不知道如何聆听由以下事件引发的事件: 在PF示例中http://www.primefaces.org/showcase/ui/dialogFramewo

  • > DAO层类型:jar Rest服务层类型:war,依赖:DAO{scope:default,type:jar}

  • 我有一个类,它扩展了 创建表主题的第一条记录可以,但无法创建另一条记录: [PersistenceException:执行DML bindLog时出错[]错误[ERROR:重复的键值违反了唯一约束“pk\U主题”\n详细信息:键(id)=(1)已存在。]] 例外情况当然发生在这一行: 这很奇怪,因为: 它以前工作没有问题 我应该怎么做才能解决这个问题? 类(当然不是全部,只是相关的):

  • 我正在构建一个网络项目,它使用Maven进行构建,并使用泽西进行RESTful API。我使用TestNG和泽西测试框架编写了单元测试,并在内存中运行它们,而不是在网络服务器上。 在我的测试中,我对MySQL数据库进行了JDBC调用,并得到了一些结果。当我使用TestNG for Eclipse插件从Eclipse内部运行时,测试运行良好。但是,当我尝试使用以下两个命令之一从Maven运行时: 或