小编use*_*170的帖子

优化/限制缓存 Spring 的大小

我正在使用@Cacheable注释在缓存中存储一​​些方法

<cache:annotation-driven />

<bean id="cacheManager" class="org.springframework.cache.support.SimpleCacheManager">
    <property name="caches">
        <set>
             <bean class="org.springframework.cache.concurrent.ConcurrentMapCacheFactoryBean" p:name="method1" /> 
            <bean class="org.springframework.cache.concurrent.ConcurrentMapCacheFactoryBean" p:name="method2" />   
        </set>
    </property>
</bean>
Run Code Online (Sandbox Code Playgroud)

但是一旦有多个用户使用该应用程序的缓存已满从​​而阻止该应用程序。有没有办法限制缓存的大小,如果是的话,这可能会影响应用程序的数据吗?

java spring caching

7
推荐指数
1
解决办法
5934
查看次数

SqliGestionCongeBundle中不存在对象"Symfony\Component\Form\FormView"的方法"email":默认值:add.html.twig

如何在我的表单中添加文本字段,知道它在我的实体中不存在!!

我在我的树枝上有这个:

 <form action="{{ path('add_conge') }}" method="post">
<h1>{{ 'Envoyer une demande de cong&eacute;'}}</h1>

 <div>
{{ form_errors(form.email) }}
{{ form_label(form.email, 'Email Collaborateur:') }}
{{ form_widget(form.email) }}
</div>

<div>
{{ form_errors(form.dateDepart) }}
{{ form_label(form.dateDepart, 'Date depart:') }}
{{ form_widget(form.dateDepart) }}
</div>
//...
Run Code Online (Sandbox Code Playgroud)

我得到这个例外:

 Method "email" for object "Symfony\Component\Form\FormView" does not exist in SqliGestionCongeBundle:Default:add.html.twig 
Run Code Online (Sandbox Code Playgroud)

php symfony

3
推荐指数
1
解决办法
3521
查看次数

没有为约束Symfony \ Component \ Validator \ Constraints \ DateTime Symfony2配置默认选项

嗨,我有这个异常:没有为约束Symfony \ Component \ Validator \ Constraints \ DateTime配置默认选项

在我的控制器中,我有:

use Symfony\Component\Validator\Constraints\DateTime;
class DefaultController extends Controller
{


public function  test2Action()
{

    $em = $this->getDoctrine()->getEntityManager();
    $id = 1; // ID du bureau de test que l'on a enregistré précédemment

    $desk = $this->getDoctrine()->getRepository('MytestBundle:Desk')->find($id);
    echo "Le bureau récupéré porte l'ID: ".$desk->getId()." et le titre: ".$desk->getTitle();

    $comment = new DeskComment();
    $comment->setDescrption("Mon premier commentaire: Joli bureau !");
    $comment->setSubmissionIp($this->getRequest()->server->get('REMOTE_ADDR'));
    $comment->setCreateAt(new DateTime('now'));
    $comment->setDesk($desk); // On lie le commentaire à notre bureau d'ID 1

    $em->persist($comment); // …
Run Code Online (Sandbox Code Playgroud)

php datetime symfony

1
推荐指数
1
解决办法
3742
查看次数

标签 统计

php ×2

symfony ×2

caching ×1

datetime ×1

java ×1

spring ×1