我正在玩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)
如果它已经存在,它怎么能不存在?
我创建了这个类
<?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) 我应该包含/ 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)
我伸展时是否应该要求父类?或者只是使用扩展子类到它的父类,即使它们在同一个文件夹中?
我已经看过很多教程和应用程序将他们的jar放在构建路径中,而其他人将它放在他们的web-inf/lib文件夹中,是否有任何显着差异?两者的优点和缺点是什么?我将一个jar放在libs文件夹中并将jar放在构建路径中的指示器是什么?
这是我的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) 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配置是什么?
这是我的主要应用程序配置
@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) 我只使用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端点.
PHP中的对象破坏有多重要?使用它们后在PHP中销毁对象很重要吗?因为与java不同,PHP没有垃圾收集器(我不知道)
我已经读过,将要使用的盐应该与散列密码具有相同的长度,这背后的原因是什么?它会增加密码保护吗?我在这里读到了 :
为了使攻击者无法为每个可能的盐创建查找表,盐必须很长.一个好的经验法则是使用与散列函数输出大小相同的salt.例如,SHA256的输出是256位(32字节),因此salt应至少为32个随机字节.