小编Yur*_*ryn的帖子

事务注释在Spring Boot中不起作用

@Transactional在Spring Boot中不起作用.

Application.java:

@EnableTransactionManagement(proxyTargetClass=true)
@SpringBootApplication(exclude = {ErrorMvcAutoConfiguration.class})
public class Application {

    @Autowired
    private EntityManagerFactory entityManagerFactory;


    public static void main(String[] args) {
        System.out.println("--------------------------- Start Application ---------------------------");
        ApplicationContext ctx = SpringApplication.run(Application.class, args);
    }

    @Bean
    public SessionFactory getSessionFactory() {
        if (entityManagerFactory.unwrap(SessionFactory.class) == null) {
            throw new NullPointerException("factory is not a hibernate factory");
        }
        return entityManagerFactory.unwrap(SessionFactory.class);
    }

    @Bean
    public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
        LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
        em.setDataSource(dataSource());
        em.setPackagesToScan(new String[] { "com.buhryn.interviewer.models" });

        JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
        em.setJpaVendorAdapter(vendorAdapter);
        em.setJpaProperties(additionalProperties());

        return em;
    }

    @Bean …
Run Code Online (Sandbox Code Playgroud)

java spring hibernate jpa spring-boot

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

Chrome搜索功能(ctrl + f)会找到隐藏的文字(但它不可见!)

看看这个小提琴.

输入Ctrl+ F并搜索"获取"...

对我来说,Chrome会从此文本中找到不可见的文字: A long option that gets cut off

它在Linux/Ubuntu 12.04 Chrome版本31.0.1650.63上重现

HTML

<!--works for a div-->
<div>
    A long option that gets cut off
</div>

<!--but not for a select-->
<select>
    <option>One - A long option that gets cut off</option>
    <option>Two - A long option that gets cut off</option>
</select>
Run Code Online (Sandbox Code Playgroud)

CSS

select {
    width:100px; 
    overflow:hidden; 
    white-space:nowrap; 
    text-overflow:ellipsis;
}

div {
    border-style:solid; 
    width:100px; 
    overflow:hidden; 
    white-space:nowrap; 
    text-overflow:ellipsis;
}
Run Code Online (Sandbox Code Playgroud)

如何在页面上显示文本,而不是浏览器突出显示的空白块空白?

html css google-chrome ellipsis styling

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

通过令牌进行Spring Security身份验证

我有一个带有API的服务器.服务器受Spring Security保护.

我希望在请求参数中使用令牌从外部应用程序访问API

首先,用户将转到为其提供令牌的服务,然后使用此令牌访问API.

但我希望通过标准的Spring Security解决方案保留以前对API的访问.

那么,请你帮助我,我该如何实现呢?

spring-mvc spring-security

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

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