小编Ole*_*uts的帖子

如何删除git用户属性?

我不小心键入了以下错误的git命令。

git config --global user.mail example@example.com
Run Code Online (Sandbox Code Playgroud)

现在,当我输入时,我会看到一个额外的属性git config--list

user.mail = "example@example.com"
Run Code Online (Sandbox Code Playgroud)

我如何摆脱它?

git git-config

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

为什么私有基类构造函数导致"隐式超级构造函数不可见"

如果构造函数不在Java中继承,为什么我会得到编译错误(隐式超级构造函数A()对于默认构造函数是不可见的.必须定义一个显式构造函数)?

class A {
    private A() {
    }
}

public class B extends A {

}
Run Code Online (Sandbox Code Playgroud)

UPD.我知道super()在隐式B构造函数中调用它.但我不明白为什么它无法访问私有构造函数super().那么,如果我们只有私有构造函数,那么事实上是final什么?

java inheritance constructor private

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

Google Drive API Application data accessing credentials from Web browser(Javascript)

I'm trying to obtain credentials from Google Console to access my Application Drive data through Web browser(Javascript) option (In order to use Picker API latter on). But when I select option Application data(Access data belonging to your own application) I got the message:

无法从 Web 浏览器安全地访问应用程序数据。请考虑选择其他平台。

谁能解释一下,为什么它不安全,以及如何使用 Web 浏览器访问我的应用程序数据,也许应该选择不同的凭据?

谢谢。

google-drive-api google-api-js-client google-picker

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

Spring Security JDBC身份验证未经授权

我不需要Admin角色,所以我只需要执行身份验证.

@Configuration
@EnableWebSecurity
protected static class WebSecurityConfig extends WebSecurityConfigurerAdapter {

    @Autowired
    private DataSource dataSource;

    @Autowired
    private MyAuthenticationSuccessHandler authenticationSuccessHandler;


    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http.authorizeRequests().anyRequest().authenticated().and().formLogin().loginPage("/login")
                .successHandler(authenticationSuccessHandler).failureUrl("/login?error").permitAll().and().logout()
                .permitAll();
        http.csrf().disable();

    }

    @Override
    public void configure(AuthenticationManagerBuilder auth) throws Exception {

        auth.jdbcAuthentication().dataSource(dataSource)
                .usersByUsernameQuery("select login, password, enabled from users where login=?");

    }

}
Run Code Online (Sandbox Code Playgroud)

我的问题是,当我尝试运行它时,我得到了

org.springframework.security.authentication.InternalAuthenticationServiceException: PreparedStatementCallback; bad SQL grammar [select username,authority from authorities where username = ?]; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'phonebook.authorities' doesn't exist
Run Code Online (Sandbox Code Playgroud)

,这是合乎逻辑的,因为我没有.authoritiesByUsernameQuery()应用方法.问题是我该如何克服它?如何在不需要查询数据库的情况下为所有用户分配默认角色?如何仅使用登录名和密码从数据库登录,并且没有角色?

authentication authorization jdbc spring-security spring-java-config

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

JPA Hibernate将两个外键放到同一个表中

我已经找到了两个这个这个主题,但仍然无法填充到我的案例中.我有一个Account.我可以Payments从一个帐户到另一个帐户.出于这个目的,我想存储payer_account_idreceiver_account_idPayments表中.如何使用Annotations进行映射? 在此输入图像描述

@Entity
public class Account {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    private Double balance;

    //mapping here to Payments Entity
    private ???

}


@Entity
    public class Payments {
        @Id
        @GeneratedValue(strategy = GenerationType.IDENTITY)
         private Long id;
        private Double ammount;

        //mapping here to Account Entity
        private Account payerAccount;

        //mapping here to Account Entity
        private Account receiverAccount;

    }
Run Code Online (Sandbox Code Playgroud)

java mysql orm hibernate jpa

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