天道酬勤,学无止境

spring

WSEncryptBody/WSSignEnvelope: Element to encrypt/sign not found

问题 我正在尝试连接到安全的肥皂网络服务,它使用 x.509 证书身份验证。 我有 .p12 客户端密钥和 .pfx 服务器密钥。 请找到以下配置和代码。 我得到的错误是 - 未找到要加密/签名的元素:http://www.w3.org/2005/08/addressing, Action 我的POM; <groupId>test-pps-2</groupId> <artifactId>test-pps-2</artifactId> <version>1.0-SNAPSHOT</version> <properties> <cxf.version>2.6.0</cxf.version> <spring.version>3.2.4.RELEASE</spring.version> <wss4j.version>1.6.19</wss4j.version> </properties> <dependencies> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-frontend-jaxws</artifactId> <version>${cxf.version}</version> </dependency> <dependency> <groupId>org.apache.cxf</groupId>

2022-07-11 09:56:40    分类:技术分享    spring   web-services   soap   cxf   wss4j

Hystrix Dashboard Issue in Spring Boot

问题 我是 Hystrix 仪表板的新手。 我已经用 Hystrix 编写了示例应用程序。 我想查看 Hystrix 图表(命令度量流)。 但我收到以下错误: Circuit: Unable to connect to Command Metric Stream Thread Pools: Loading... 我正在将 STS 与 Maven 一起使用。 下面是使用的代码: 简单的服务器微服务应用(Spring boot web 运行在 8085 端口) package hello; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RequestMapping; @RestController @SpringBootApplication public class BookstoreApplication { @RequestMapping(value = "

2022-07-11 09:52:37    分类:技术分享    spring   spring-boot   hystrix

Combining Spring-Data for MongoDB and ElasticSearch

问题 我正在努力 @org.springframework.data.mongodb.core.mapping.Document(collection = "goal") @org.springframework.data.elasticsearch.annotations.Document(indexName = "goal") public class Goal implements Serializable { ....} 但这给了我: Error creating bean with name 'goalRepository': Invocation of init method failed; nested exception is org.springframework.data.mapping.PropertyReferenceException: No property insert found for type Goal! -> 顺便说一句:只要我将名为“插入”的属性添加到目标或从目标中删除弹性搜索注释,该错误就会消失。 目标存储库是: package org.jhipster.mongo.repository; import org.jhipster.mongo.domain.Goal; import org.springframework.data

2022-07-11 09:48:20    分类:技术分享    java   spring   mongodb   spring-data-mongodb   spring-data-elasticsearch

using <form> within <foreach> a few time

问题 我对 Spring 很陌生,我正在尝试使用 Spring MVC + JSP + JSTL。 我的目标是制作包含用户列表的 JSP,并允许将每个用户与其他用户分开编辑。 所以我认为我应该为列表中的每个用户使用单独的<form>标记和单独的<sumbit>按钮,我的 JSP 看起来像: <c:forEach items="${userList}" var="currentUser" varStatus="index"> <form:form method="post" action = "edit" commandName="userList[${index}]"> <tr> <td><form:input path = "userList[${index}].login" value = "${currentUser.login}" /></td> <td><form:input path = "userList[${index}].password" value = "${currentUser.password}" /></td> <td><form:input path = "userList[${index}].smtpServer" value = "${currentUser.smtpServer}" /></td> <td><form:input path =

2022-07-11 09:35:04    分类:技术分享    java   spring   spring-mvc   jstl

How to give starting value to auto increment in hibernate

问题 @Id @Column (name = "ID") @GeneratedValue(generator="increment") @GenericGenerator(name="increment", strategy = "increment") private Integer ID; 回答1 试试这个:http://www.java2s.com/Code/Java/JPA/SetInitialValueOfTableGenerator.htm JPA 有一个 @TableGenerator 注释,您可以在其中设置初始值。 回答2 回答3 如果第一个需要的 ID 是 1000000,则使用 @TableGenerator,但如果第一个需要的 ID 是 1000001,则使用 @SequenceGenerator。 本文以非常清晰的方式解释了差异: http://www.objectdb.com/java/jpa/entity/generated

2022-07-11 09:33:44    分类:技术分享    java   spring   hibernate

Where to store user uploads in spring mvc application?

I am wondering where should i save files uploaded by user in my application. Right now i am saving them right into webapps/images/uploads(webapps folder is mapped as resource folder via mvc-resource) folder and they are instantly available to display after upload. But i am not sure if this is the right thing to do? how will redeployment of application affect the files already stored there? won't it complicate back ups of application? so basically where should i store them on server? and is this affected somehow by using local(windows) or remote(linux) server Thanks

2022-05-24 20:10:17    分类:问答    java   spring   file-upload   spring-mvc

Spring Autowire with Bean creation in same class results in :Requested bean is currently in creation Error*

问题 我知道该错误是不言自明的,但是当我将其余模板的设置从构造函数中删除到 @Autowired @Qualifier("myRestTemplate") private RestTemplate restTemplate 时,它​​可以工作。 只是想知道如果同一个类具有我要自动装配的 bean 定义,我该如何在构造函数中执行此操作? org.springframework.beans.factory.BeanCurrentlyInCreationException:创建名为“xxx”的bean时出错:请求的bean当前正在创建中:是否存在无法解析的循环引用? @Component public class xxx { private RestTemplate restTemplate; @Autowired public xxx(@Qualifier("myRestTemplate") RestTemplate restTemplate) { this.restTemplate = restTemplate; } @Bean(name="myRestTemplate") public RestTemplate getRestTemplate() { return new RestTemplate(); } } 回答1 常规@Component注释类中的 @Bean

2022-05-17 05:31:23    分类:技术分享    java   spring   autowired

why did the adivce not work in my project based on Spring-framework?

问题 我使用它如下: @Component @Aspect public class RecordActivity { @Pointcut("execution(public void test.article.service.ArticleService.*(..))") public void addArticle(){}; @Around("addArticle()") public void addActivity(ProceedingJoinPoint joinPoint){ System.out.println("------add an article-------"); try { writer.write(object.getObject()); } catch (IOException e1) { e1.printStackTrace(); bufferWriter.closeResource(); ServiceUtil.outOfError(response,"error!!!"); return; } bufferWriter.closeResource(); try { joinPoint.proceed(params); } catch (Throwable e) { e.printStackTrace(); } } 控制器 @Controller

2022-05-17 05:29:22    分类:技术分享    java   spring   aop

Spring 4 JDBC - How to load DB Properties and optimize (using Cache or DB Connection Pool)

问题 我正在维护一个用 Spring MVC 4.3.9.RELEASE(不是 Spring Boot)编写的代码库...... 在 src/main/resources 下: 有两个不同的数据库配置文件: 示例数据库.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> <!-- Initialization for

2022-05-17 05:27:04    分类:技术分享    spring   spring-jdbc   spring-cache

Spring 4 Join point to get method argument names and values

问题 回答1 @Aspect @Component public class SomeAspect { @Around("@annotation(SomeAnnotation)") public Object aroundAdvice(ProceedingJoinPoint joinPoint) throws Throwable { CodeSignature codeSignature = (CodeSignature) joinPoint.getSignature(); System.out.println("First parameter's name: " + codeSignature.getParameterNames()[0]); System.out.println("First argument's value: " + joinPoint.getArgs()[0]); return joinPoint.proceed(); } } 回答2 CodeSignature methodSignature = (CodedSignature) joinPoint.getSignature(); String[] sigParamNames = codeSignature.getParameterNames(); 回答3 在您的 AOP 建议中,您可以使用

2022-05-17 05:10:04    分类:技术分享    spring   spring-aop