小编use*_*206的帖子

PostgreSQL DBLink:没有函数匹配给定的名称和参数类型

我正在玩DBLINK,我想尝试一下.所以我运行这个简单的查询

CREATE EXTENSION dblink;

SELECT *  
FROM dblink(('dbname=genesis_admin')::text,
      ('SELECT * FROM user_account')::text);
Run Code Online (Sandbox Code Playgroud)

然后让我惊讶

[WARNING  ] CREATE EXTENSION dblink
            ERROR:  extension "dblink" already exists
[WARNING  ] SELECT *  FROM dblink(('dbname=genesis_admin')::text, ('SELECT * FROM user_account')::text)
            ERROR:  function dblink(text, text) does not exist
            LINE 1: SELECT *  FROM dblink(('dbname=genesis_admin')::text, ('SELE...
                                   ^
            HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
Run Code Online (Sandbox Code Playgroud)

如果它已经存在,它怎么能不存在?

sql postgresql

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

某些类的访问级别必须是PHP中的公共错误

我创建了这个类

<?php
    abstract class Validator{
        public $_errors = array();
        abstract public function isValid($input);

        public function _addErrors($message){
            $this->_errors = $message;
        }

        public function getErrors(){
            return $this->_errors;
        }


        public function getMessage(){
            return $this->message;
        }
    }

    class Validator_NoSpaces extends Validator{

        public function __construct($value){
            $this->isValid($value);
        }
        public function isValid($value){
                if (preg_match('/\s/', $value)){
                $this->_addErrors("Spaces are not allowed");
                return false;
            }
            return true;
        }       
    }

    class Validator_MinimumLength extends Validator{

        protected $_minLength;
        protected $value;

        public function __construct($value ,$minLength=8){
            $this->_minLength = $minLength;
            $this->value = $value;
            $this->isValid($value);
        }

        public …
Run Code Online (Sandbox Code Playgroud)

php dry public abstract

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

在PHP中扩展父类是否需要包含类的文件?

我应该包含/ require_once我在PHP中扩展的父类吗?

例如,我有一个名为Shapes的类

class Shapes {

}
Run Code Online (Sandbox Code Playgroud)

然后我创建了一个名为的子类

require_once('shapes.php');

class Circle extends Shapes {

}
Run Code Online (Sandbox Code Playgroud)

我伸展时是否应该要求父类?或者只是使用扩展子类到它的父类,即使它们在同一个文件夹中?

php oop inheritance require

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

Java配置构建路径或WEB-INF/lib文件夹

我已经看过很多教程和应用程序将他们的jar放在构建路径中,而其他人将它放在他们的web-inf/lib文件夹中,是否有任何显着差异?两者的优点和缺点是什么?我将一个jar放在libs文件夹中并将jar放在构建路径中的指示器是什么?

java jar build classpath java-ee

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

Spring Boot viewControllerHandlerMapping配置

这是我的Application.java的示例要点

@Configuration
@EnableAutoConfiguration
@ComponentScan(basePackages = "org.com.app.client.controller")
@EnableJpaRepositories(basePackages = "org.com.app")
@EntityScan(basePackages = "org.com.app.model")
public class Application extends SpringBootServletInitializer {

    public static void main(String[] args) {
        ApplicationContext ctx = SpringApplication.run(Application.class, args);
    }

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(Application.class);
    }


    /**
     * Spring Web MVC Confugrations
     *
     **/
    @Bean
    public ExceptionHandlerExceptionResolver exceptionHandlerExceptionResolver(){
        ExceptionHandlerExceptionResolver exceptionHandlerExceptionResolver = new ExceptionHandlerExceptionResolver();
        return  exceptionHandlerExceptionResolver;
    }
    @Bean
    public ViewResolver internalResourceViewResolver(){
        InternalResourceViewResolver viewResolver = new InternalResourceViewResolver();
        viewResolver.setPrefix("/WEB-INF/jsp/");
        viewResolver.setSuffix(".jsp");
        return  viewResolver;
    }
Run Code Online (Sandbox Code Playgroud)

但是当我尝试运行我的mvn spring-boot时:运行此异常总是会发生.我错过了什么?

12:30:22.670 [org.brightworks.genesis.client.Application.main()] WARN  o.s.b.c.e.AnnotationConfigEmbeddedWebApplicationContext - …
Run Code Online (Sandbox Code Playgroud)

java spring spring-mvc spring-boot

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

Spring的JavaConfig:作用域代理

JavaConfig与此相当的是什么?

<!-- an HTTP Session-scoped bean exposed as a proxy
     that acts as session storage.
-->
<bean id="checkOutCounter" class="org.brightworks.genesis.client.forms.CheckOutCounter" scope="session">
    <!-- this next element effects the proxying of the surrounding bean -->
    <aop:scoped-proxy/>
</bean>
Run Code Online (Sandbox Code Playgroud)

尝试声明这样,但它只作为一个单身人士

@Bean
public CheckOutCounter checkOutCounter(){
    return new CheckOutCounter();
}
Run Code Online (Sandbox Code Playgroud)

相同的xml配置是什么?

spring

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

Spring启动安全配置 - 必须指定authenticationManager

这是我的主要应用程序配置

@SpringBootApplication
public class Application {

    public static void main(String[] args) {
        new SpringApplicationBuilder(Application.class)
                .banner((environment, aClass,  printStream) ->
                        System.out.println(stringBanner()))
                .run();
    }
}
Run Code Online (Sandbox Code Playgroud)

这是我的spring security应用程序配置.

@Configuration
@EnableGlobalMethodSecurity(prePostEnabled = true)
@EnableWebMvcSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {

    @Autowired
    private WebServiceAuthenticationEntryPoint unauthorizedHandler;

    @Autowired
    private TokenProcessingFilter authTokenProcessingFilter;

    @Bean
    @Override
    public AuthenticationManager authenticationManagerBean() throws Exception {
        return super.authenticationManagerBean();
    }

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http
                .csrf()
                .disable()
                .sessionManagement()
                .sessionCreationPolicy(SessionCreationPolicy.STATELESS) // Restful hence stateless
                .and()
                .exceptionHandling()
                .authenticationEntryPoint(unauthorizedHandler) // Notice the entry point
                .and() …
Run Code Online (Sandbox Code Playgroud)

java spring spring-security spring-boot

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

使用JHipster访问Swagger文档

我只使用jhipster生成了一个app服务器.

yo jhipster --skip-client
Run Code Online (Sandbox Code Playgroud)

它在访问时产生了我需要的所有必要的api调用

http://localhost:8080/swagger-ui/index.html
Run Code Online (Sandbox Code Playgroud)

我以404结束了.我的印象是包含了招摇,但似乎无法访问,尽管可以使用昂首阔步的api端点.

jhipster

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

使用后我是否需要在PHP中销毁对象?

PHP中的对象破坏有多重要?使用它们后在PHP中销毁对象很重要吗?因为与java不同,PHP没有垃圾收集器(我不知道)

php object

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

为什么盐的长度与散列值相同?

我已经读过,将要使用的盐应该与散列密码具有相同的长度,这背后的原因是什么?它会增加密码保护吗?我在这里读到了 :

为了使攻击者无法为每个可能的盐创建查找表,盐必须很长.一个好的经验法则是使用与散列函数输出大小相同的salt.例如,SHA256的输出是256位(32字节),因此salt应至少为32个随机字节.

java security passwords

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