【java – Sharedpreferences不起作用,默认值】教程文章相关的互联网学习教程文章

java – @Cachable注释不起作用【代码】

我们在项目中使用ehcache进行缓存.import com.googlecode.ehcache.annotations.Cacheable; // Other imports@Component public class Authenticator{@Cacheable(cacheName = "rest_client_authorized")public boolean isUserAuthorized(final String user, final String sessionId) {// Method code} }进入方法时,没有缓存拦截器.到目前为止我们检查的东西: >我们不会在课堂内调用此方法,而是从外部调用.所以问题不是导致绕过代理...

JavaFX 2:自动换行在ScrollPane中不起作用【代码】

如果我将自动换行设置为标签并将其放在任何布局中 – 除非我将标签放到ScrollPane,否则自动换行工作正常.这是一个例子:@Override public void start(Stage primaryStage) {primaryStage.setTitle("Test");BorderPane borderPane = new BorderPane();VBox myView = new VBox();Label label = new Label("Lorem ipsum dolor sit amet, consectetur adipisicing elit," +" sed do eiusmod tempor incididunt ut labore et dolore mag...

java – Hibernate JDBC批量大小不起作用【代码】

我正在使用SpringFramework 3和Hibernate 4以及MySQL 5和jpa.我的测试代码看起来像……@Repository public class TestRepositoryImpl implements TestRepository {@PersistenceContextprivate EntityManager em;@Override@Transactionalpublic void insertBulk() {Item it;for(int i= 0; i<1000;i++) {it = new Item();it.setPrice(Math.random()*100);em.persist(it);}} }我的弹簧配置<bean id="entityManagerFactory"class="org....

java – Spring cron工作不起作用【代码】

我是Spring框架的新手.目前我尝试整合cron作业服务. 我将服务类定义为:package com.test.cron; @Service public class CronJob {protected static final Logger logger = Logger.getLogger(PasswordRemindFlusher.class);@Scheduled(cron="0 0/2 * * * ?")public void demoServiceMethod(){logger.debug("Cron job started.");} }然后我在servlet配置中定义:<context:component-scan base-package="com.test.cron" />为spring-se...

java – 这个do-while循环不起作用,我无法理解为什么【代码】

所以我正在尝试创建一个程序,用户输入其学生的年龄,直到它进入-1.在-1之后,程序必须计算学生人数和平均年龄.出于某种原因,我无法摆脱do-while循环.太头疼了!无论如何,这是代码提前致谢.public static void main(String[] args) {// InputScanner input = new Scanner(System.in);// Variablesint escapeNumber = 0;int[] studentsAge = new int[50];do {// InputSystem.out.println("Student's age (Type -1 to end): ");// Set e...

spring – Camel的BridgePropertyPlaceholderConfigurer在使用Java配置时不起作用【代码】

我正在使用Spring Java配置并使用一些Camel路由编写控制台应用程序.我的应用程序中有几个属性源,因此我使用了两个PropertyPlaceholderConfigurers:@Configuration @Import(CamelConfig.class) @ComponentScan(basePackageClasses = {App.class}) public class Config {final static String ENV = System.getProperty( "ENV" );@Beanpublic static BridgePropertyPlaceholderConfigurer properties(){final BridgePropertyPlacehol...

java – @Where子句在hibernate连接查询中不起作用【代码】

我有2个@Where注释实体.第一个是分类;@Where(clause = "DELETED = '0'") public class Category extends AbstractEntity它有以下关系;@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, mappedBy = "category") private Set<SubCategory> subCategories = Sets.newHashSet();第二个实体是SubCategory;@Where(clause = "DELETED = '0'") public class SubCategory extends AbstractEntity并包含对应关系;@ManyToOne(...

java – 使用WebAppCreator创建的GWT Maven项目在devmode中不起作用【代码】

我已经通过这种方式创建了一个带有maven配置的GWT项目:webAppCreator -out HelloWorldGWT -templates sample,maven,readme ua.vitvyaz.hellowordgwt.HelloWorldGWT我试图在devmode上运行项目:mvn gwt:devmode但在浏览器中我得到了:"HTTP ERROR 404 Problem accessing /HelloWorldGWT.html.Reason: Not Found"我看,目录WEB-INF是空的. pom.xml有什么问题? pom.xml中:<?xml version="1.0" encoding="UTF-8"?> <project xmlns="h...

java – JPA Lazy加载在Spring启动时不起作用【代码】

我google了很多,Spring Boot(最新版本)可能没有延迟加载是行不通的.以下是我的代码: 我的资源:public ResponseEntity<Page<AirWaybill>> searchAirWaybill(CriteraDto criteriaDto, @PageableDefault(size = 10) Pageable pageable{ airWaybillService.searchAirWaybill(criteriaDto, pageable);return ResponseEntity.ok().body(result); }我的服务:@Service @Transactional public class AirWaybillService {//Methodspublic ...

keyboard – 死键在Java Swing应用程序中不起作用【代码】

我目前正在使用Ubuntu 10.10和Netbeans 7.0,我不能再用死键键入重音字母了.它不是特定于版本的问题似乎与Swing有关,因为我对旧版本的Netbeans和操作系统有同样的问题. 当我在Linux上的任何应用程序上键入’a’时,我会得到一个元音.所有Linux应用程序都运行良好,但Netbeans没有.当我输入’a Netbeans时,我得到一个元音(没有重音).我也不能输入引号和双引号. 但我使用正确的Alt键在Netbeans上获得了重音. (那不是我想要的) 在终端我得...

java – 如果我们不生成窗口,为什么Timer不起作用?【代码】

这是代码:import java.awt.event.ActionEvent; import java.awt.event.ActionListener;import javax.swing.JFrame; import javax.swing.Timer;public class TimerSample {public static void main(String args[]) {new JFrame().setVisible(true);ActionListener actionListener = new ActionListener() {public void actionPerformed(ActionEvent actionEvent) {System.out.println("Hello World Timer");}};Timer timer = new T...

Java命令lastModified()在Clojure中不起作用【代码】

我试图通过执行Java命令从Clojure中的文件获取最后修改时间.通过使用java.io.File.lastModified我应该能够获得UNIX时间,这不能通过执行脚本或在REPL中工作. 我的代码是: (java.io.File.lastModified“/home/lol/lolness.txt”) 我的错误是: java.lang.ClassNotFoundException:java.io.File.lastModified(NO_SOURCE_FILE:24) (java.io.File.separator)可以工作. 编辑:Clojure版本1.2.0-master-SNAPSHOTJava版OpenJDK...

java – Spring MVC @AutoWired响应不起作用【代码】

我有 :@Controller @RequestMapping(value="admin/*", method=RequestMethod.GET) public class AdminController {@Autowiredprivate HttpServletRequest request;@Autowiredprivate HttpServletResponse response;@RequestMappingpublic ResponseEntity<String> test0() {System.out.println("ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ");return null;}}和标签:<mvc:annotation-driven />在我的config.xml中 我觉...

java-size()函数在Processing 3.0中不起作用【代码】

我试图通过从图像宽度和高度传递参数来设置窗口的大小在Processing 3.0.但是,Processing正在抛出错误并要求检查参考部分,这对您没有帮助.代码如下.PImage img; ...void setup(){img = loadImage("XYZ.JPG");float w = img.width;float h = img.height;size(int(w), int(h));image(img, 0, 0); }和错误如下:size() function cannot be used here解决方法:如果您正在使用setup()函数中的size()函数,那么它必须是您调用的第一个函数,...

java – Spring数据中的@Transient不起作用【代码】

我有结算实体@Entity @Table(name = "settlement") public class Settlement {@ManyToOne@JoinColumn(name = "subscription_x_product_id")private ProductSubscription productSubscription;与ProductSubscription实体相关@Entity @Table(name = "subscriptionproduct") public class ProductSubscription {@ManyToOne@JoinColumn(name = "product_id")private Product product;与Product实体相关@Entity public class Product {@...