我尝试在ASC上按顺序在表上创建一个Spring-Data-JPA应用程序,但它给了我一个错误:
Invalid derived query! No property asc found for type java.util.Calendar
Run Code Online (Sandbox Code Playgroud)
为什么?
List<Foo> findAllOrderByDateAsc();
Run Code Online (Sandbox Code Playgroud)
要么
@Query("SELECT * FROM foo ORDER BY date ASC")
List<Foo> findAllOrderByDateAsc();
Run Code Online (Sandbox Code Playgroud) 我对mongoose很新,所以我想知道是否有某种方法来设置custom error message而不是默认的方式Validator "required" failed for path password.
我想设置一些Password is required.更加用户友好的东西.
我写了一些自定义验证器并type使用此用户友好的错误消息设置属性,但我不确定type是错误消息的正确占位符.也没有办法在预定义的验证器上设置自定义消息min, max, required, enum...
一种解决方案是检查每次type抛出错误的属性并手动分配错误消息,但认为这是验证者的工作:
save model
if error
check error type (eg. "required")
assign fancy error message (eg. "Password is required.")
Run Code Online (Sandbox Code Playgroud)
这显然不是理想的解决方案.
我查看了express-form和node-validator,但仍想使用mongoose验证功能.
我需要帮助解决Spring和代理问题.
org.springframework.beans.factory.BeanNotOfRequiredTypeException:名为'fooAPIService'的bean必须是[com.foo.clientapi.service.FooAPIService]类型,但实际上是[com.sun.proxy.$ Proxy110]类型
org.springframework.beans.factory.BeanCreationException:创建名为'activityController'的bean时出错:资源依赖注入失败; 嵌套异常是org.springframework.beans.factory.BeanNotOfRequiredTypeException:名为'fooAPIService'的bean必须是[com.foo.clientapi.service.FooAPIService]类型,但实际上是[com.sun.proxy.$ Proxy110]类型
Webapp项目 - >
春天上下文
<context:annotation-config/>
<context:component-scan base-package="com.foo.controller"/>
<aop:aspectj-autoproxy />
<aop:config proxy-target-class="true"/>
<mvc:annotation-driven/>
Run Code Online (Sandbox Code Playgroud)
ActivityController.class
import com.foo.clientapi.service.FooAPIService;
...
@Controller
@RequestMapping(value = "/toto")
public class ActivityController {
@Resource
private FooAPIService fooAPIService;
...
}
Run Code Online (Sandbox Code Playgroud)
另一个项目(微服务) - >
FooAPIService.class
@Path("/foos")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public interface FooAPIService {
...
}
Run Code Online (Sandbox Code Playgroud)
Jaxrs配置:
<jaxrs:client id="fooAPIService"
address="${toto}"
threadSafe="true"
serviceClass="com.foo.clientapi.service.FooAPIService"
inheritHeaders="true">
...
</jaxrs:client>
Run Code Online (Sandbox Code Playgroud)
版本:aspectjweaver:1.6.10 aspectjrt:1.6.11 cglib:2.2 Spring 3.2.2
我有一个“父表”和带有很多列的年份分区表,现在我需要将一列更改为VARCHAR(32),TEXT因为我们需要更多的长度灵活性。
所以我会改变父他们也会改变所有的分区。
但是该表有 2 个唯一索引和 1 个索引。
此查询锁定表:
ALTER TABLE my_schema.my_table
ALTER COLUMN column_need_change TYPE VARCHAR(64) USING
column_need_change :: VARCHAR(64);
Run Code Online (Sandbox Code Playgroud)
还有这个:
ALTER TABLE my_schema.my_table
ALTER COLUMN column_need_change TYPE TEXT USING column_need_change :: TEXT;
Run Code Online (Sandbox Code Playgroud)
我看到这个解决方案:
UPDATE pg_attribute SET atttypmod = 64+4
WHERE attrelid = 'my_schema.my_table'::regclass
AND attname = 'column_need_change ';
Run Code Online (Sandbox Code Playgroud)
但我不喜欢这个解决方案。
如何将VARCHAR(32)类型更改为TEXT无锁表,我需要在更新之间继续推送表中的一些数据。
我的 Postgresql 版本:9.6
编辑 :
这是我最终采取的解决方案:
ALTER TABLE my_schema.my_table
ALTER COLUMN column_need_change TYPE TEXT USING column_need_change :: TEXT;
Run Code Online (Sandbox Code Playgroud)
查询将我的表锁定在:1m 52s 548ms …
如何加密密码将其插入数据库并在比较后何时连接?
我会使用StandardPasswordEncoder Spring security 3.1.4来加密我的密码并插入到db中.但是如何恢复该方法生成的盐?
这是doc Spring安全性的一个例子:
StandardPasswordEncoder encoder = new StandardPasswordEncoder("secret");
String result = encoder.encode("myPassword");
assertTrue(encoder.matches("myPassword", result));
Run Code Online (Sandbox Code Playgroud)
我问她,因为我需要重新编码密码进行比较?并验证用户是否必须输入正确的密码?
这里密码编码: 9e7e3a73a40871d4b489adb746c31ace280d28206dded9665bac40eabfe6ffdc32a8c5c416b5878f
我会比较编码新密码
Link Doc Spring:http://docs.spring.io/spring-security/site/docs/3.1.4.RELEASE/reference/crypto.html Link API SPring security 3.1.4:http://docs.spring.io /spring-security/site/docs/3.1.4.RELEASE/apidocs/
我和Debian jessie有一个ec2实例,当我执行此命令时:
apt-get install ecs-init
Run Code Online (Sandbox Code Playgroud)
我收到一个错误包未找到..
所以我需要在我的Debian上添加新的depo?
它没有为我工作:http://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-agent-install.html
谢谢.
java ×3
postgresql ×3
spring ×3
alter-table ×1
amazon-ec2 ×1
amazon-ecs ×1
aspect ×1
cglib ×1
debian ×1
docker ×1
express ×1
mongodb ×1
mongoose ×1
node.js ×1
spring-aop ×1
spring-data ×1
sql ×1