我正在使用JHipster开发基于Spring Boot和AngularJS的应用程序.我的问题是如何设置上传文件的最大大小?
如果我正在尝试上传到大文件,我将在控制台中获取此信息:
DEBUG 11768 --- [io-8080-exec-10] c.a.app.aop.logging.LoggingAspect:
Enter: com.anuglarspring.app.web.rest.errors.ExceptionTranslator.processRuntimeException() with argument[s] =
[org.springframework.web.multipart.MultipartException: Could not parse multipart servlet request; nested exception is java.lang.IllegalStateException:
org.apache.tomcat.util.http.fileupload.FileUploadBase$FileSizeLimitExceededException: The field file exceeds its maximum permitted size of 1048576 bytes.]
Run Code Online (Sandbox Code Playgroud)
服务器响应状态为500.
怎么设置?
我使用jhipster构建一个应用程序,这是一个使用cassandra db的微服务网关,并使用maven构建,在scaffold.i运行gulp命令之后构建正常用于ui的实时重新加载.
我在导航栏和主页上做了一个变化.这也是工作文件,并在家庭和导航栏的json文件中做了一些更改,并在添加搜索框和其他时做了一些小的更改.
它无法重新加载.我停下了gulp&maven并重新启动它们.maven正在构建但是再次没有在localhost中加载该站点
当我跑了一口气时,它向我显示了这个错误.
gulp
fs.js:952
return binding.readdir(pathModule._makeLong(path), options.encoding);
^
Error: ENOENT: no such file or directory, scandir '/home/hartron/foodnetteam/codebase/mandi/node_modules/node-sass/vendor'
at Error (native)
at Object.fs.readdirSync (fs.js:952:18)
at Object.getInstalledBinaries (/home/hartron/foodnetteam/codebase/mandi/node_modules/node-sass/lib/extensions.js:121:13)
at foundBinariesList (/home/hartron/foodnetteam/codebase/mandi/node_modules/node-sass/lib/errors.js:20:15)
at foundBinaries (/home/hartron/foodnetteam/codebase/mandi/node_modules/node-sass/lib/errors.js:15:5)
at Object.module.exports.missingBinary (/home/hartron/foodnetteam/codebase/mandi/node_modules/node-sass/lib/errors.js:45:5)
at module.exports (/home/hartron/foodnetteam/codebase/mandi/node_modules/node-sass/lib/binding.js:15:30)
at Object.<anonymous> (/home/hartron/foodnetteam/codebase/mandi/node_modules/node-sass/lib/index.js:14:35)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
Run Code Online (Sandbox Code Playgroud)
谁能告诉我这方面的解决方案
我正在创建一个具有微服务架构的项目.我创建了两个微服务.
其中一个是产品实体,另一个是票据实体.它们有自己的端点,它们通过网关连接在一起(我使用的是jhipster微服务架构).
bill-ms应该访问产品列表.我想知道如何在这两个ms之间进行通信.我脑子里有三种方法:
从bill-ms发送请求到队列 - 就像rabbitMQ一样,从product-ms获取带有这些id的这些产品(我不知道这是什么瓶颈)
向网关发送请求以获取产品服务并从那里获取产品(由于它们之间的数据大小而我担心延迟,因此我不直接接触数据库所以我总是依赖于网关)
我可以在bill-ms中复制存储库,服务和实体(这是一种丑陋的方式,我认为它打破了ms架构的规则并且维护非常困难)
如果您有任何其他方法,我感谢您与我分享.
编辑
我使用jhipster生成器来创建一个项目.我已经按照jhipster文档中提供的信息手动生成了一些实体:
如果您更喜欢(或需要)手动进行数据库更新,这里是开发工作流程:修改您的JPA实体(添加字段,关系等)在src/main/resources /中创建一个新的"更改日志" config/liquibase/changelog目录.该目录中的文件以其创建日期为前缀(以yyyyMMddHHmmss格式),然后有一个标题描述它们的作用.例如,20141006152300_added_price_to_product.xml是一个好名字.在src/main/resources/config/liquibase/master.xml文件中添加此"更改日志"文件,以便在下次运行应用程序时应用它如果您想了解有关使用Liquibase的更多信息,请访问http:/ /www.liquibase.org.
这里的文档只是提到,如何添加!!! 如果我想删除字段或实体之间的关系(jpa实体)该怎么办?
谢谢
我正在使用JHipster开发一个应用程序.我已将以下内容添加到application-dev.yml文件中:
spring:
profiles:
active: dev
multipart:
maxFileSize: -1
Run Code Online (Sandbox Code Playgroud)
但是当我尝试上传> 1MB的文件时,我仍然收到错误:
Caused by: org.apache.tomcat.util.http.fileupload.FileUploadBase$SizeLimitExceededException: the request was rejected because its size (20663006) exceeds the configured maximum (10485760)
Run Code Online (Sandbox Code Playgroud)
我错过了什么?看来这应该是非常直截了当的.
更新1
我spring按照安迪的建议从配置中取消了它,但仍然得到了错误.更新了yml文件:
server:
port: 8080
multipart:
maxFileSize: -1
spring:
profiles:
active: dev
datasource: ...
Run Code Online (Sandbox Code Playgroud)
更新2
在较新版本的Sprint Boot上再次讨论这个问题,不得不改为:
spring:
http:
multipart:
max-file-size: 30MB
max-request-size: 30MB
Run Code Online (Sandbox Code Playgroud) 有没有办法授权使用特定网址的帖子请求org.springframework.security.config.annotation.web.builders.HttpSecurity?
我用的HttpSecurity是:
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.addFilterAfter(new CsrfCookieGeneratorFilter(), CsrfFilter.class)
.exceptionHandling()
.authenticationEntryPoint(authenticationEntryPoint)
.and()
.rememberMe()
.rememberMeServices(rememberMeServices)
.key(env.getProperty("jhipster.security.rememberme.key"))
.and()
.formLogin()
.loginProcessingUrl("/api/authentication")
.successHandler(ajaxAuthenticationSuccessHandler)
.failureHandler(ajaxAuthenticationFailureHandler)
.usernameParameter("j_username")
.passwordParameter("j_password")
.permitAll()
.and()
.logout()
.logoutUrl("/api/logout")
.logoutSuccessHandler(ajaxLogoutSuccessHandler)
.deleteCookies("JSESSIONID")
.permitAll()
.and()
.headers()
.frameOptions()
.disable()
.authorizeRequests()
.antMatchers("/api/register").permitAll()
.antMatchers("/api/activate").permitAll()
.antMatchers("/api/authenticate").permitAll()
.antMatchers("/api/logs/**").hasAuthority(AuthoritiesConstants.ADMIN)
.antMatchers("/api/subscriptions").permitAll()
.antMatchers("/api/**").authenticated();
}
Run Code Online (Sandbox Code Playgroud)
我想允许POST请求到/ api/subscription路径.只有POST.谢谢.
我已经创建了示例jHipster app.现在我想在本地添加自签名SSL证书和测试以访问https.怎么做到这一点?
我正在尝试在使用JHipster生成的项目上添加一个新角色(ROLE_REPORTS).我可以看到需要更新的表(角色,权限和role_authority映射),但我不知道如何去解决它的Java部分.
我可以想出一些零碎的东西,但我担心我的定制可能会破坏一些设计理念(如Swagger API,Spring Security等)
有没有人已经尝试过,如果有的话,任何正确方向的帮助都将受到高度赞赏.
对于(Java8 + Oauth2 + MySql + Hazelcast +无群集http会话)组合,我在prod模式下遇到错误.开发模式运行良好.
Unable to register MBean [HikariDataSource (HikariPool-0)] with key 'dataSou
rce'; nested exception is javax.management.InstanceAlreadyExistsException: com.z
axxer.hikari:name=dataSource,type=HikariDataSource
Run Code Online (Sandbox Code Playgroud)
在日志中,数据源(hazelcast)创建的第一部分表示[dev]模式.不确定这是故意的.
请帮助我解决问题.
Dec 12, 2014 2:44:11 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive D:\tools\apache-tomcat-7.0.55\webapps\re
tailenergy.war
[INFO] com.fg.re.ApplicationWebXml - Running with Spring profile(s) : prod
2014-12-12 14:44:19.125 WARN 1368 --- [ost-startStop-1] o.s.b.l.LoggingApplicat
ionListener : Logging environment value '-Djava.util.logging.config.file="
D:\tools\apache-tomcat-7.0.55\conf\logging.properties"' cannot be opened and wil
l be ignored (using default location instead)
log4j:WARN No appenders could …Run Code Online (Sandbox Code Playgroud) 我有一个 jhipster 项目,几个月以来它用 gitlab 部署在 heroku 上
从昨天开始,我无法部署新版本,因为我有这个错误
FAILURE: Build failed with an exception.
32 * What went wrong:
33 A problem occurred configuring root project 'yvidya'.
34 > Could not resolve all artifacts for configuration ':classpath'.
35 > Could not resolve io.spring.gradle:propdeps-plugin:0.0.10.RELEASE.
36 Required by:
37 project :
38 > Could not resolve io.spring.gradle:propdeps-plugin:0.0.10.RELEASE.
39 > Could not get resource 'http://repo.spring.io/plugins- release/io/spring/gradle/propdeps-plugin/0.0.10.RELEASE/propdeps-plugin-0.0.10.RELEASE.pom'.
40 > Could not GET 'http://repo.spring.io/plugins-release/io/spring/gradle/propdeps-plugin/0.0.10.RELEASE/propdeps-plugin-0.0.10.RELEASE.pom'. Received status code 403 from server: Forbidden
Run Code Online (Sandbox Code Playgroud)
有谁知道为什么会出现这个错误?以及如何解决?