【发布时间】:2017-09-19 03:10:20
【问题描述】:
我是 Maven 项目的新手,因此请多多指教。我有一个 jersey REST 项目,其目录结构如下:
我的计划是使用MediaType.MULTIPART_FORM_DATA将文件保存到磁盘并通过hibernate将文件路径保存到DB。
至于存储图像,我打算在src/main/resource 下创建一个名为img 的新文件夹(与hibernate.cfg.xml 处于同一级别)并将图像保存在那里。
问题:
- 我的方法正确吗?有更好的建议吗?
-
我是否需要更改
pom.xml才能添加任何标签。我目前的pom.xml如下http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion> <groupId>com.xxx.xxx</groupId> <artifactId>xxx</artifactId> <packaging>war</packaging> <version>0.0.1-SNAPSHOT</version> <name>xxx</name> <build> <finalName>xxx</finalName> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.5.1</version> <inherited>true</inherited> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> </plugins> </build> <dependencyManagement> <dependencies> <dependency> <groupId>org.glassfish.jersey</groupId> <artifactId>jersey-bom</artifactId> <version>${jersey.version}</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> <dependencies> <!-- jersey --> <dependency> <groupId>org.glassfish.jersey.containers</groupId> <artifactId>jersey-container-servlet-core</artifactId> <!-- use the following artifactId if you don't need servlet 2.x compatibility --> <!-- artifactId>jersey-container-servlet</artifactId --> </dependency> <!-- JSON support --> <dependency> <groupId>org.glassfish.jersey.media</groupId> <artifactId>jersey-media-moxy</artifactId> </dependency> <!-- postgresql --> <dependency> <groupId>org.postgresql</groupId> <artifactId>postgresql</artifactId> <version>42.1.4</version> </dependency> <!-- hibernate --> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> <version>5.2.10.Final</version> </dependency> <dependency> <groupId>cglib</groupId> <artifactId>cglib</artifactId> <version>3.2.5</version> </dependency> <!-- logging for hibernate --> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>1.7.25</version> </dependency> <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-core</artifactId> <version>1.2.3</version> </dependency> <!-- password hashing --> <dependency> <groupId>org.mindrot</groupId> <artifactId>jbcrypt</artifactId> <version>0.3m</version> </dependency> <!-- http client --> <dependency> <groupId>com.squareup.okhttp3</groupId> <artifactId>okhttp</artifactId> <version>3.9.0</version> </dependency> </dependencies> <properties> <jersey.version>2.25</jersey.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties>
提前致谢。
【问题讨论】:
标签: java hibernate maven jersey-2.0