我使用相机拍照后使用com.android.camera.action.CROP进行裁剪.
下面是我之前在4.3之前工作的代码.
Intent cropIntent = new Intent("com.android.camera.action.CROP");
cropIntent.setType("image/*");
cropIntent.putExtra("crop", "true");
cropIntent.putExtra("aspectX", 1);
cropIntent.putExtra("aspectY", 1);
cropIntent.putExtra("outputX", Conf.getInt("IMAGE_WIDTH"));
cropIntent.putExtra("outputY", Conf.getInt("IMAGE_HEIGHT"));
cropIntent.putExtras(extras);
startActivityForResult(cropIntent, CROP_REQUEST_CODE);
Run Code Online (Sandbox Code Playgroud)
但是现在,由于android裁剪操作会将您带到图库(因为图库默认为裁剪),因此裁剪方法失败(照片未保存到图库).
有没有人知道解决这个问题的方法.我可以在相机拍摄的照片上使用裁剪
我的应用程序基于Spring Boot,Hibernate,MySQL使用Spring Data JPA来拼接它们.
用例是使用从数据库节点进行大量读取操作,以避免从主mysql节点提供所有流量.实现此目的的一种方法是让多个实体管理器指向单独的数据源(一个到主节点,另一个到从节点).在下面的SO问题和博客中已经很好地解释了这种方式.
Spring Boot,Spring Data JPA,带有多个DataSources
https://scattercode.co.uk/2016/01/05/multiple-databases-with-spring-boot-and-spring-data-jpa/
我遇到的问题是要了解是否有一种方法可以在我的Repository Annotated Interface中为不同的用例注入不同的实体管理器.
我看到它可以完成的唯一方法是使用自定义实现来扩展存储库,该实现提供了使用相关persistenceContext注释的自定义实体管理器,如下所示.
public interface CustomerRepository extends JpaRepository<Customer, Integer>, MyCustomCustomerRepository{
}
public class MyCustomCustomerRepositoryImpl implements MyCustomCustomerRepository {
@PersistenceContext(unitName = "entityManagerFactoryTwo")
EntityManager entityManager;
}
Run Code Online (Sandbox Code Playgroud)
我想避免做这个自定义实现.任何有关解决此用例(我觉得应该非常常见)的帮助将不胜感激.
注意:两个数据库中的实体都相同,因此为实体扫描提供单独的包,类似的解决方案可能不起作用.