小编gs_*_*lad的帖子

Kotlin Regex任命团体支持

Kotlin是否支持命名的正则表达式组?

命名的正则表达式组看起来像这样: (?<name>...)

regex regex-group kotlin

11
推荐指数
3
解决办法
5466
查看次数

Spring自我注入交易

在Spring中,你不能简单地@Transactional从同一个实例调用方法,因为AOP代理的东西.自我注入并从自代理实例调用该方法是不是一个好主意?你看到任何缺点吗?

java spring spring-aop spring-transactions

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

WPF绑定到UserControl自定义DependencyProperty

我有一个名为SongDescription的自定义UserControl:

<UserControl x:Class="DPTestAp.SongDescription" ...>
    <Grid x:Name="LayoutRoot">
        <DockPanel Height="50">
            <TextBlock x:Name="title" Text="{Binding name}" Width="100" Height="30"/>
            <TextBox x:Name="lyrics"/>
        </DockPanel>
    </Grid>
</UserControl>
Run Code Online (Sandbox Code Playgroud)

我添加了DependencyProperty:

public partial class SongDescription : UserControl
{
    public static readonly DependencyProperty SongProperty = DependencyProperty.Register("Song", typeof(Song), typeof(SongDescription));

    public Song Song
    {
        get
        {
            return (Song)GetValue(SongProperty);
        }
        set
        {
            SetValue(SongProperty, value);
            updateLyrics()
        }
    }

    private void updateLyrics()
    {
        lyrics.Text = Song.lyrics;
    }

    public SongDescription()
    {
        InitializeComponent();
    }
}
Run Code Online (Sandbox Code Playgroud)

问题是:如何将某些东西绑定到这个SongProperty?我在我的主窗口中使用SongDescription,如下所示:

<local:SongDescription x:Name="songDescription" Song="{Binding DataContext}"/>
Run Code Online (Sandbox Code Playgroud)

我无法让我的TextBox 歌词显示歌词.在主窗口中,我尝试将DataContext设置为songDescription,如下所示:

songDescription.DataContext = new Song() { name="Home", …
Run Code Online (Sandbox Code Playgroud)

wpf binding user-controls dependency-properties

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

无法在spring boot security中登录我的自定义登录页面

我的问题是:当我尝试登录我的自定义登录页面时,它会再次将我重定向到登录页面(如果我输入正确或错误的凭据,则无关紧要).在调试中我没有达到我的自定义UserDetailService也很奇怪,我认为这意味着spring甚至不会检查用户的凭据.

我有自定义登录表单/WEB-INF/jsp/login.jsp:

...    
<form name='loginForm' action="<c:url value='j_spring_security_check' />" method='POST'>

        <table>
            <tr>
                <td>User:</td>
                <td><input type='text' name='j_username' value=''></td>
            </tr>
            <tr>
                <td>Password:</td>
                <td><input type='password' name='j_password' /></td>
            </tr>
            <tr>
                <td colspan='2'><input name="submit" type="submit"
                                       value="submit" /></td>
            </tr>
        </table>

        <input type="hidden" name="${_csrf.parameterName}"
               value="${_csrf.token}" />

    </form>
...
Run Code Online (Sandbox Code Playgroud)

这是配置:

@Configuration
@EnableWebMvcSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {

    @Autowired
    private UserDetailsService userDetailsService;

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http
                .authorizeRequests().antMatchers("/", "/welcome", "/resources/**").permitAll()
                .anyRequest().authenticated().and()
                .formLogin().loginPage("/login").failureUrl("/login?error").permitAll().and()
                .logout().logoutUrl("/login?logout").permitAll();
    }

    @Autowired
    public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
        auth.userDetailsService(userDetailsService).passwordEncoder(passwordEncoder()); …
Run Code Online (Sandbox Code Playgroud)

java jsp spring-mvc spring-security spring-boot

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

在ReactJS中渲染2个表行

我想实现表的可扩展行功能.假设我们有一个包含任务名称和任务复杂性的表.单击任务时,任务说明如下所示.我尝试用ReactJS(在render方法中)这样做:

  if (selectedTask === task.id) {
    return [
      <tr>
        <td>{task.name}</td>
        <td>{task.complexity}</td>
      </tr>,
      <tr>
        <td colSpan="2">{task.description}</td>
      </tr>
    ];
  } else {
    return <tr>
      <td>{task.name}</td>
      <td>{task.complexity}</td>
    </tr>;
  }
Run Code Online (Sandbox Code Playgroud)

它不起作用.它说: A valid ReactComponent must be returned. You may have returned undefined, an array or some other invalid object 我也尝试在div中包装2行,但我得到错误的渲染.请提出正确的解决方案.

html javascript html-table reactjs

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