小编Jun*_*ing的帖子

Spring Security oauth2 客户端 - Twitter 问题

我想将 Twitter oAuth2 添加到我的应用程序中。早些时候,我成功添加了 Facebook 和 google - 我不必添加提供商。当我尝试将 twitter 数据添加到application.properties文件并运行服务器时,出现错误:

Error starting Tomcat context. Exception: org.springframework.beans.factory.UnsatisfiedDependencyException. Message: Error creating bean with name 'securityConfig': Unsatisfied dependency expressed through method 'setContentNegotationStrategy' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration$EnableWebMvcConfiguration': Unsatisfied dependency expressed through method 'setConfigurers' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.security.config.annotation.web.configuration.OAuth2ClientConfiguration$OAuth2ClientWebMvcSecurityConfiguration': Unsatisfied dependency expressed through method 'setClientRegistrationRepository' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.security.oauth2.client.servlet.OAuth2ClientRegistrationRepositoryConfiguration': …
Run Code Online (Sandbox Code Playgroud)

java twitter-oauth spring-boot spring-security-oauth2

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

Symfony 中的简单查询返回 null

我需要从读数表中获取最高温度。我尝试将此 sql 查询转换为与createQueryBuilder()

查询语句: SELECT temperature_value FROM read_outs WHERE room_id = 3

这在 PHPMyAdmin 中工作,我得到了结果。现在我只想从所有结果中获得最大值。

我在存储库中创建函数:

public function getMaxTemperatureByRoom($id)
{
    $this->createQueryBuilder('read_out')
        ->select('read_out, MAX(read_out.temperatureValue) AS 
max_temperature')
        ->where('read_out.roomId = :id')
        ->setParameter('id', $id)
        ->getQuery()
        ->getResult();
}
Run Code Online (Sandbox Code Playgroud)

这是我的实体类:

 <?php

   namespace Smart\SensorBundle\Entity;

   use Doctrine\ORM\Mapping as ORM;
   use Smart\RoomBundle\Entity\Room;



/**
    * Class ReadOut
    * @package Smart\SensorBundle\Entity
    *
    * @ORM\Table(name="read_outs")
* 

@ORM\Entity(repositoryClass=
"Smart\SensorBundle\Repository\ReadOutReposi    tory")
 */
class ReadOut
{
/**
 * @var int
 *
 * @ORM\Column(name="id", type="integer")
 * @ORM\Id
 * @ORM\GeneratedValue(strategy="AUTO")
 */
private $id;

/**
 * @var …
Run Code Online (Sandbox Code Playgroud)

php doctrine symfony

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